carl1905 Posted August 20, 2016 Share Posted August 20, 2016 (edited) Hi, I have in trouble converting *.txt to original binary format. I attached my sample text file. The one what I want is 1) If text contains "[" and "]" then Split text into array. 2) Convert StringToBinary btw "[" and "]" 3) Convert other strings(Japanese) to Shift-JIS. For example, like this. $text_unicode = "すばらしい!<lf>すばらしいです、[010004300020FF]さん!" [010004300020FF] to 0x010004300020FF and other text values into Shift-JIS. $result = 0x82B782CE82E782B582A282C582B78141010004300020FF82B382F18149 Result in hex editor My problem is related with this post. [Solved] Extracting text from string and reinsert it. Edited August 21, 2016 by carl1905 No ones reply Link to comment Share on other sites More sharing options...
carl1905 Posted August 21, 2016 Author Share Posted August 21, 2016 (edited) How can I convert 020000300020FF to 0x02 0x00 0x00 0x30 0x00 0x20 0xFF..? Can someone help me? $Newtext &= Binary("0x"&$split[$i][0]) My script always returns $split[$i][0] = 020000300020FF to 0x30 0x32 0x30 0x30 0x30 0x30 0x33 0x30 0x30 0x30 0x32 0x30 0x46 0x46 Edited August 21, 2016 by carl1905 Link to comment Share on other sites More sharing options...
carl1905 Posted August 21, 2016 Author Share Posted August 21, 2016 Ok.. it seems that $Newtext &= _HexToString($split[$i][0]) Convert 1F040017300020FF to 1F0400173000203F By the way why FF is converted to 3F? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now