carl1905 Posted April 23, 2016 Posted April 23, 2016 (edited) I attached simple text that is written in Japanese(01 Original text) and Korean(02 Transformed text). It contains just 1 word that means "Quantum Mechanics". The question is how can I transform 01 to 02 using table.txt file? sample.zip Edited April 23, 2016 by carl1905
jchd Posted April 23, 2016 Posted April 23, 2016 I don't believe there can exist such one-to-one correspondance between those codepages. Nevertheless it's still possible to achieve what you want. Build a table of 64k entries. Entry address in the table is the Japanese character code, read as a 16-bit integer. Entry value is the corresponding Korean character code. Note that not all characters in JIS use 16-bit encoding; you have to decode the text flow to decide whether the next char is 8- or 16-bit wide. See https://en.wikipedia.org/wiki/Shift_JIS for a primer. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
carl1905 Posted April 23, 2016 Author Posted April 23, 2016 (edited) 45 minutes ago, jchd said: I don't believe there can exist such one-to-one correspondance between those codepages. Nevertheless it's still possible to achieve what you want. Build a table of 64k entries. Entry address in the table is the Japanese character code, read as a 16-bit integer. Entry value is the corresponding Korean character code. Note that not all characters in JIS use 16-bit encoding; you have to decode the text flow to decide whether the next char is 8- or 16-bit wide. See https://en.wikipedia.org/wiki/Shift_JIS for a primer. Yes, there is no correspondence. By the way, the final goal is that there is some kind of system that only Shift-JIS is allowed. In this kind of system, I won't able to write EUC-KR. Well, the procedure that I want to do is.. 1. Extract Shift-JIS text from binary file and write it in UTF-16LE. (Solved) 2. Translation into Korean. (Solved. Actually, it doesn't need code. ) 3. Reading text from UTF-16LE txt file and put it back to binary file. (I can handle it.) My question is, in 3rd procedure, I want to change Korean words to Japanese words according to table.txt file. Because the system won't read EUC-KR, so system will read the binary file as if it is Shift-JIS. But actually I change the array of the Shit-JIS to my own corresponding table. For example, 1) Original text is 'ABC' (=0x414243) 2) Deleting ABC and write BAC. (=0x424143) 3) Making a table and write 0x41=B, 0x42=C, 0x43=A. 4) Change the text file according to table and put it back to binary file. 5) Then the result is still BAC according to table, but the binary array is 0x414342. Edited April 23, 2016 by carl1905
jchd Posted April 23, 2016 Posted April 23, 2016 So use the 64K array to "translate" as you want. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
carl1905 Posted April 23, 2016 Author Posted April 23, 2016 (edited) 29 minutes ago, jchd said: So use the 64K array to "translate" as you want. Ok, thank you! I will try it. Edited April 23, 2016 by carl1905
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