hi,
can anyone help we with converting a txt file from ANSI to UNICODE, what is the method on doing this ?
text file to unicode file
Started by
erezlevi
, Jan 10 2008 03:39 PM
4 replies to this topic
#1
Posted 10 January 2008 - 03:39 PM
#2
Posted 10 January 2008 - 06:53 PM
It's very deep and complicated, but if you want to wade into it:hi,
can anyone help we with converting a txt file from ANSI to UNICODE, what is the method on doing this ?
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
#3
Posted 15 April 2012 - 02:37 PM
Related/similar problem (yes I know this is an old thread, but perhaps putting them together makes sense for the next guy/gal searching):
I have a file that is produced with the DOS "sort" command and it's in codepage 850. No FileOpen choice seems to read it correctly. Does AutoIt have a way to deal with this or does someone else know a way to deal with either getting DOS (Windows 7 in this case) to output it differently or to convert it afterwards?
Thank you!
I have a file that is produced with the DOS "sort" command and it's in codepage 850. No FileOpen choice seems to read it correctly. Does AutoIt have a way to deal with this or does someone else know a way to deal with either getting DOS (Windows 7 in this case) to output it differently or to convert it afterwards?
Thank you!
#4
Posted 15 April 2012 - 04:42 PM
dleigh,
perhaps this will help:
http://www.autoitscript.com/forum/topic/...string-from-codepage-437-or-85
or lok at this:
http://waterlan.home.xs4all.nl/dos2unix/dos2unix_beta.htm#conversion_modes
it has: Convert from DOS CP850 to Unix Latin-1
opensource: http://sourceforge.net/projects/dos2unix/
perhaps this will help:
http://www.autoitscript.com/forum/topic/...string-from-codepage-437-or-85
or lok at this:
http://waterlan.home.xs4all.nl/dos2unix/dos2unix_beta.htm#conversion_modes
it has: Convert from DOS CP850 to Unix Latin-1
opensource: http://sourceforge.net/projects/dos2unix/
Edited by Jury, 15 April 2012 - 05:09 PM.
#5
Posted 15 April 2012 - 05:01 PM
Can you try this and report success/failure?
Edit: I saw the previous post after sending mine. My ad hoc function is equivalent to the WinAPI call.
; read old DOS CP850 file Local $hdl = FileOpen("Dos850.txt", 16) ; read in binary mode Local $binText850 = FileRead($hdl) FileClose($hdl) Local $text = __CodepageStructToString($binText850) ; from there, $text is a genuine copy of the Dos file, but now using native AutoIt Unicode encoding. ConsoleWrite($text & @LF) Func __CodepageStructToString($tText) Local $aResult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", 850, "dword", 0, "struct*", $tText, "int", -1, _ "ptr", 0, "int", 0) If @error Then Return SetError(1, @error, "") ; Dllcall error Local $tWstr = DllStructCreate("wchar[" & $aResult[0] & "]") $aResult = DllCall("Kernel32.dll", "int", "MultiByteToWideChar", "uint", 850, "dword", 0, "struct*", $tText, "int", -1, _ "struct*", $tWstr, "int", $aResult[0]) If @error Then Return SetError(2, @error, "") ; Dllcall error Return DllStructGetData($tWstr, 1) EndFunc
Edit: I saw the previous post after sending mine. My ad hoc function is equivalent to the WinAPI call.
Edited by jchd, 15 April 2012 - 05:05 PM.
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQL tutorial (covers generic SQL, but most of it apply to SQLite as well)An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious workPCRE v8.32 regexp pattern documentation. AutoIt uses a slightly older version so that more advanced features are not all available.RegExp tutorial: enough to get started
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users






