Jump to content
carl1905

Transforming text using table file.

Recommended Posts

carl1905

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 by carl1905

Share this post


Link to post
Share on other sites
jchd

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 here
RegExp tutorial: enough to get started
PCRE 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)

Share this post


Link to post
Share on other sites
carl1905
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 by carl1905

Share this post


Link to post
Share on other sites
jchd

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 here
RegExp tutorial: enough to get started
PCRE 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)

Share this post


Link to post
Share on other sites
carl1905
29 minutes ago, jchd said:

So use the 64K array to "translate" as you want.

Ok, thank you! I will try it.

Edited by carl1905

Share this post


Link to post
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

  • Similar Content

    • mar3011
      By mar3011
      hello, I want to set in the inputbox field random key from the keyboard to which the function will be assigned, for example F4 function start notepad ALT + A function start notepad for one function. Thank you for any help.  
    • JuanFelipe
      By JuanFelipe
      Cambiar a español Hello friends, I need help with a problem I have, I want to know if there is any way to update a GUI already running, that is I have a GUI of a certain size and with a button I would like to enlarge it:
      example: $ form1 = GUICreate ("", 200,100,0,0)   When you press the button, the gui increases its size, and actuates the new size.
    • BogdanNicolescu
      By BogdanNicolescu
      While 1 / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / WEnd OR:

       
      HotKeySet("{ESC}", "Terminate") While 1 MouseClick("Right",674,422) MouseClick("Left",673,447) Sleep(2000) / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / MouseClick("Left",675,339) SLeep(3000) WEnd Func Terminate()     Exit 0 EndFunc  
      Sorry if i should't let this here to be found by newbies like me -.-'
    • santoshM
      By santoshM
      Dear friends i am facing a problem , i have created a window in autoit some time it is moving with the mouse curser even if iam not clicking the window 
    • sumanth1980
      By sumanth1980
      Here i am wrote a simple lines to install basic applications but when i clicked on one application/program to install it was working fine but when i cancel the program in the middle to install another program it was not working. I am not an expert in this but i want a solution for this ... Can any one help me on this....
      ORG-1.au3
×