Jump to content

EBCDIC to ASCII


nobbe
 Share

Recommended Posts

hi

there may be a more elegant solution to this, but i convert the chars that i need, others i dont really need

;
;   $Recv = _Ebcdic_2_ascii($Recv)  
; 
; --- convert ebcdic into ASCII
Func _Ebcdic_2_ascii($in_buffer)
    Local $r_text = ''
    
    ; other 
    $r_text = StringReplace($in_buffer, "@", Chr(32)); blank
    $r_text = StringReplace($r_text, ",", " "); .
    $r_text = StringReplace($r_text, "}", " ");
    $r_text = StringReplace($r_text, "O", " "); !
    $r_text = StringReplace($r_text, "Q", "e"); !
    $r_text = StringReplace($r_text, "`", "-");
    $r_text = StringReplace($r_text, "z", ":");
    $r_text = StringReplace($r_text, "N", "+");
    $r_text = StringReplace($r_text, "\", "*");
    $r_text = StringReplace($r_text, "k", ",");
    $r_text = StringReplace($r_text, "_", "(");
    $r_text = StringReplace($r_text, "]", ")");
    $r_text = StringReplace($r_text, "^", ";");
    $r_text = StringReplace($r_text, "P", "&");

    $r_text = StringReplace($r_text, "a", "/");  
    $r_text = StringReplace($r_text, "j", "ö");
    $r_text = StringReplace($r_text, ",", " ");   its a "."

    $r_text = StringReplace($r_text, "À", "ä");   its a "."

    ;$r_text = StringReplace($r_text, CHR(74) , " " ); "¢");
    ;$r_text = StringReplace($r_text, CHR(91) , " " ) ; "$");
    ;$r_text = StringReplace($r_text, CHR(97) , " " ); "/");
    ;$r_text = StringReplace($r_text, CHR(108) , " " );"%");
    $r_text = StringReplace($r_text, Chr(109), "(");        
    $r_text = StringReplace($r_text, Chr(123), "#");

    $r_text = StringReplace($r_text, Chr(124), "@");
    $r_text = StringReplace($r_text, Chr(129), "a");
    $r_text = StringReplace($r_text, Chr(130), "b");
    $r_text = StringReplace($r_text, Chr(131), "c");
    $r_text = StringReplace($r_text, Chr(132), "d");
    $r_text = StringReplace($r_text, Chr(133), "e");
    $r_text = StringReplace($r_text, Chr(134), "f");
    $r_text = StringReplace($r_text, Chr(135), "g");
    $r_text = StringReplace($r_text, Chr(136), "h");
    $r_text = StringReplace($r_text, Chr(137), "i");
    $r_text = StringReplace($r_text, Chr(145), "j");
    $r_text = StringReplace($r_text, Chr(146), "k");
    $r_text = StringReplace($r_text, Chr(147), "l");
    $r_text = StringReplace($r_text, Chr(148), "m");
    $r_text = StringReplace($r_text, Chr(149), "n");
    $r_text = StringReplace($r_text, Chr(150), "o");
    $r_text = StringReplace($r_text, Chr(151), "p");
    $r_text = StringReplace($r_text, Chr(152), "q");
    $r_text = StringReplace($r_text, Chr(153), "r");
    $r_text = StringReplace($r_text, Chr(162), "s");
    $r_text = StringReplace($r_text, Chr(163), "t");
    $r_text = StringReplace($r_text, Chr(164), "u");
    $r_text = StringReplace($r_text, Chr(165), "v");
    $r_text = StringReplace($r_text, Chr(166), "w");
    $r_text = StringReplace($r_text, Chr(167), "x");
    $r_text = StringReplace($r_text, Chr(168), "y");
    $r_text = StringReplace($r_text, Chr(169), "z");
    $r_text = StringReplace($r_text, Chr(193), "A");
    $r_text = StringReplace($r_text, Chr(194), "B");
    $r_text = StringReplace($r_text, Chr(195), "C");
    $r_text = StringReplace($r_text, Chr(196), "D");
    $r_text = StringReplace($r_text, Chr(197), "E");
    $r_text = StringReplace($r_text, Chr(198), "F");
    $r_text = StringReplace($r_text, Chr(199), "G");
    $r_text = StringReplace($r_text, Chr(200), "H");
    $r_text = StringReplace($r_text, Chr(201), "I");
    $r_text = StringReplace($r_text, Chr(209), "J");
    $r_text = StringReplace($r_text, Chr(210), "K");
    $r_text = StringReplace($r_text, Chr(211), "L");
    $r_text = StringReplace($r_text, Chr(212), "M");
    $r_text = StringReplace($r_text, Chr(213), "N");
    $r_text = StringReplace($r_text, Chr(214), "O");
    $r_text = StringReplace($r_text, Chr(215), "P");
    $r_text = StringReplace($r_text, Chr(216), "Q");
    $r_text = StringReplace($r_text, Chr(217), "R");
    $r_text = StringReplace($r_text, Chr(226), "S");
    $r_text = StringReplace($r_text, Chr(227), "T");
    $r_text = StringReplace($r_text, Chr(228), "U");
    $r_text = StringReplace($r_text, Chr(229), "V");
    $r_text = StringReplace($r_text, Chr(230), "W");
    $r_text = StringReplace($r_text, Chr(231), "X");
    $r_text = StringReplace($r_text, Chr(232), "Y");
    $r_text = StringReplace($r_text, Chr(233), "Z");
    $r_text = StringReplace($r_text, Chr(240), "0");
    $r_text = StringReplace($r_text, Chr(241), "1");
    $r_text = StringReplace($r_text, Chr(242), "2");
    $r_text = StringReplace($r_text, Chr(243), "3");
    $r_text = StringReplace($r_text, Chr(244), "4");
    $r_text = StringReplace($r_text, Chr(245), "5");
    $r_text = StringReplace($r_text, Chr(246), "6");
    $r_text = StringReplace($r_text, Chr(247), "7");
    $r_text = StringReplace($r_text, Chr(248), "8");
    $r_text = StringReplace($r_text, Chr(249), "9");

    Return $r_text

EndFunc   ;==>_Ebcdic_2_ascii
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...