carl1905

Transforming text using table file.

5 posts in this topic

#1 ·  Posted (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 by carl1905

Share this post


Link to post
Share on other sites



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

#3 ·  Posted (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 by carl1905

Share this post


Link to post
Share on other sites

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

#5 ·  Posted (edited)

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

    • RoundChecker
      By RoundChecker
      Hi everyone,

      Is there a way to determine whether the script that is running, is already running, without using;
       
      If WinExists ?

      Or is there a way to use "If WinExists" to determine the script itself?

      The reason I am asking this is because if I want someone to run the .Exe I have and they rename it to whatever they want, how could I then determine in the script to check if there's already an .Exe open, or the script itself is already open?

      Should I use Class, or how do I achieve this?

      Thanks in advance.
    • svenjatzu
      By svenjatzu
      Id like to build a little helpertool for my boss in office but i dont know how to sart it.
      thats no complicated task. im working for an insurancecenter and have to search the customers in different orders and different tags.
      due to my boss is old and not really commen with pc he saves the customers without system.
      eg, customer andreas statham got an insurenca for his car then i got to search for
      andreas statham car, andreas car statham, car andreas statham, statham andreas car, statham car andreas, car statham andreass etc to find all the files from this customer in the harddrive.
      some customers also are fmiliarnamed in one file like andreas statam and monika rog are married an both got a carinsurance then i got to earch for
      andreas statham monika rog car, andreas statham monika car rog,.... this can take real long to find the right customer if i do it from hand.
      how can i realise this someone in here got an excamlple script or has any sugestion?
       
       
    • X_xkijux_x
      By X_xkijux_x
      Ok so im using this program. clarify for school. I would like to have a program that takes every word i type in microsoft word and searches on it in claryfi. is this possible. I would like to have the program not stopping me from typing more after that word. Like when i type a word it auto search it on clarify without making me stop typing and if i want to change i can do that and if im fine that word i can just keep typing and it will search after the next word. 
    • Miliardsto
      By Miliardsto
      Is this possible to make program works like in diagram? There is so much encryption methods and UDFs are they give security? If the $Address will be crypted with some encryption algorithm could be possible to get the value of $Address in easy way? Of course We know its easy too look into autoit code and get value of variable and so We dont want to anyone see $Address value - there are functions Could func1.au3, func2.au3.. be for example func1.php or other type of file? As we know .php files are unnable to see. For example func1 would be read by FileRead() and then Execute() Is this generally possible to do?
      Will it give secure?
      What do you think about? Maybe there is something wrong in this concept or missed.

    • JaredStroeb
      By JaredStroeb
      I need to open an application and send it keys in Session 0.  I have exe's working locally, I can see the application open in session 0 through interactive services, but my send commands do not go to the application.  The following article running-autoit-session-0, directs me to use ControlSend() however my application has no controls that can be identified by AutoIt v3 Window Info.  Get All Windows Controls also returned nothing for the application's handle.  
      What are my options?  
      Can this be done with AutoIt?
      Is there a different "relatively simple" library/tool to use? (I am familiar with C# if there is a viable library there )