emendelson Posted February 25, 2018 Share Posted February 25, 2018 (edited) I've been asked to write a script that will do this: It will start with a UTF-16 text file with Arabic or Hebrew text, including line numbering, like this: 1. tfeL-to-thgiR ("tfeL-to-thgiR" represents real Right-to-Left text.) What I want the script to do is insert a Right-To-Left code after the numeral "1" and (I think) after the "." so that the "1." will appear at the right of the text, like this: tfeL-to-thgiR .1 Normally, numerals are coded Left-to-Right, so all Windows apps put the "1." on the left side of the text. What I see online is that the way to fix this is put an RTL code after the number (and maybe the punctuation) in order to accomplish this. So I got the idea that I could search for this binary string: 0D 00 0A 00 31 00 and insert the RTL code after it. The internet tells me that the UTF-16 code for this mark is 20 0F. I found a _BinaryReplace function here: and I tried to use it this way (replacing only the line numbering "1." for simplicity): $sInFile = "infile.txt" ; Original in file $sFind = "0D000A003100" ; MSFT 5.0 Original hex to find ; this is rtl code: "20 0F" $sReplace = "0D000A003100200F" ; SMASHLY! New hex to replace $sOutFile = "outfile.txt" ; New edited out file _BinaryReplace($sInFile, $sFind, $sReplace, $sOutFile) But I ended up with a degree sign next to the numeral 1. Am I missing something obvious? Thanks for any help. Edited February 25, 2018 by emendelson Clarification Link to comment Share on other sites More sharing options...
jchd Posted February 25, 2018 Share Posted February 25, 2018 You can use the Unicode codepoints mentionned here: 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) Link to comment Share on other sites More sharing options...
emendelson Posted February 26, 2018 Author Share Posted February 26, 2018 15 hours ago, jchd said: You can use the Unicode codepoints mentionned here: That is exactly what I'm trying to do - I've tried many varieties of inserting codepoints, but I keep getting characters instead. I'll keep trying and wlll report back with any success. 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