I need to save returned results (in UTF8) from SQLite database in plain text file with ASCII or ANSI code page. I tried to do it with this :
Code: Select all
WriteString(0, ResultSet$, #PB_Ascii)
what should I do?
Thanks in advance.
Code: Select all
WriteString(0, ResultSet$, #PB_Ascii)
Wouldn't you use this?silvercover wrote:Hi,
I need to save returned results (in UTF8) from SQLite database in plain text file with ASCII or ANSI code page. I tried to do it with this :
But it doesn't save with ANSI code page and save data with UTF-8 format.Code: Select all
WriteString(0, ResultSet$, #PB_Ascii)
what should I do?
Thanks in advance.
Code: Select all
WriteString(0, ResultSet$, #PB_UTF8)
I need to do this because I made a plug-in for a Non-Unicode application. so when I want to pass returned result from plug-in to that app i get some unknown characters. therefor I decided to save returned data in a plain text file with ANSI code page and let that app read results.Wouldn't you use this?
I tested it both in unicode mode and plain text mode.If your program is compiled in Unicode mode and that doesn't work, there's a bug somewhere. But most likely it works correctly and something else is astray.
Code: Select all
ResultSet.s = "ÆØÅ"
OpenFile(0, "c:\out.txt")
WriteString(0, ResultSet, #PB_Ascii)
Code: Select all
ProcedureCDLL.l SaveResult()
If OpenFile(0, Filename$)
WriteString(0, ResultSet$, #PB_Ascii)
CloseFile(0)
Saved.l = 1
Else
Saved.l = 0
EndIf
SetData(Saved)
EndProcedure
Arabic characters are on the ANSI code page #1256.Trond wrote:silvercover wrote:I have no problem when returned results are in Latin characters but when results are in non-Latin chars like Arabic the problem shows up.The ANSI character set doesn't have arabic characters.But it doesn't save with ANSI code page
No, codepage number 1256 is the arab code page. ANSI is codepage 1252 and doesn't have arab characters.Demivec wrote:Arabic characters are on the ANSI code page #1256.Trond wrote:silvercover wrote:I have no problem when returned results are in Latin characters but when results are in non-Latin chars like Arabic the problem shows up.The ANSI character set doesn't have arabic characters.But it doesn't save with ANSI code page
I see we are on the same (code) page.Trond wrote:No, codepage number 1256 is the arab code page. ANSI is codepage 1252 and doesn't have arab characters.Demivec wrote:Arabic characters are on the ANSI code page #1256.Trond wrote:silvercover wrote:I have no problem when returned results are in Latin characters but when results are in non-Latin chars like Arabic the problem shows up.The ANSI character set doesn't have arabic characters.But it doesn't save with ANSI code page
Codepage 1250 (EE)
Codepage 1251 (Cyrl)
Codepage 1252 (ANSI)
Codepage 1253 (Greek)
Codepage 1254 (Turk)
Codepage 1255 (Hebr)
Codepage 1256 (Arab)
Codepage 1257 (BaltRim)
Codepage 1258 (Viet)
So if you use code page 1256 you can use arab characters (as you said), but then it is not the ANSI codepage.
For the record I agree with you Trond but silvercover wasn't wrong either, according to the above quote.Windows code pages, commonly called "ANSI code pages", are code pages for which non-ASCII values (values greater than 127) represent international characters. These code pages are used natively in Windows 95/98/Me, and are also available on Windows NT and later.
Note: Originally, Windows code page 1252, the code page commonly used for English and other Western European languages, was based on an American National Standards Institute (ANSI) draft. That draft eventually became ISO 8859-1, but Windows code page 1252 was implemented before the standard became final, and is not exactly the same as ISO 8859-1.
Many Windows API functions have "A" (ANSI) and "W" (wide) versions. The "A" version handles text based on Windows code pages, while the "W" version handles Unicode text. See Windows Data Types for Strings and Conventions for Function Prototypes.