Iczer Posted May 6, 2017 Posted May 6, 2017 If I FileOpen/FileRead some UTF-8 file, then as result, what encoding of text I get? UTF-8 or UTF-16LE? $hFile = FileOpen($sFilePath,$FO_UTF8) $sFile = FileRead($hFile) FileClose($hFile)
czardas Posted May 6, 2017 Posted May 6, 2017 (edited) You will get the UTF-8 interpretation of the binary. I am no expert on this, but you may sometimes get the same characters when you open a file in the wrong encoding, depending on byte-order and possibly a number of other factors. I'm hoping someone with more working knowledge can correct me if I'm wrong, or add further information. Edited May 6, 2017 by czardas operator64 ArrayWorkshop
Iczer Posted May 6, 2017 Author Posted May 6, 2017 At first i'm also thought it would be UTF-8 but... I have RSS XML File - it UTF-8 encoded. If I open and read it with $FO_UTF8, and then parse it (without errors) and display result in "_ArrayDisplay()" function I'm getting normal text, even if it Unicode. But if i Try to use $sXML = _WinAPI_MultiByteToWideChar($sXML, 65001, 0, True) $sXML = StringReplace($sXML,'encoding="utf-8"','encoding="utf-16"') After "FileRead()" I'm get parse errors and any Unicode text replaced by question marks "???"...
jchd Posted May 6, 2017 Posted May 6, 2017 @Iczer, Since the file is open in UTF8 mode, FileRead will interpret UTF8 content and yield a native (UTF16) string. Zero need for user-side conversion. Reveal hidden contents 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)
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