| |
Membre enregistré 26 messages |
|
Posté le 20 novembre 2014 - 14:41 |
How to detect if the text file you are accessing/opening is ansi or unicode format? |
| |
| |
| | | |
|
| | |
| |
Posté le 20 novembre 2014 - 15:04 |
Hi
When you load it in a buffer variable, the first 2 bytes contains a specific value in UNICODE mode. Be careful that there are several variants of Unicode (little endian, big endian...), so there may be several different header value to test.
You can of course check that out by using an Hexadecimal editor on your files
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
NEW: WXReplication, your open source replication system is available on my web site!!! WXShowroom.com: Show your projects! More information on http://www.fabriceharari.com
On 11/20/2014 8:41 AM, JOHNKEN wrote:
How to detect if the text file you are accessing/opening is ansi or unicode format? |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 651 messages Popularité : +175 (223 votes) |
|
Posté le 20 novembre 2014 - 15:20 |
Procedure WS_Android_IOS_HTTPGetResult()
bufResHTTP is Buffer sHTTPResult is string
bufResHTTP = HTTPGetResult(httpResult)
IF IniOSMode() = True OR IniOSSimulatorMode() = True OR IniOSEmulatorMode() = True IF StringCount(bufResHTTP, “ISO-8859-1”, IgnoreCase) = 0 THEN sHTTPResult = UTF8ToString(bufResHTTP) ELSE sHTTPResult = AnsiToUnicode(bufResHTTP) END ELSE IF InAndroidMode() = True OR InAndroidSimulatorMode() = True OR InAndroidEmulatorMode() = True
sHTTPResult = bufResHTTP END
RESULT sHTTPResult |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 651 messages Popularité : +175 (223 votes) |
|
Posté le 20 novembre 2014 - 15:28 |
JOHNKEN
I work with Windev Mobile set IN [x] ANSI GLOBAL project
I had to make this overall Procedure for making the identification was coming up the RETURN of the HTTPRequest with Unicode OR ANSI IN HTTPGetResult, I stopped using the standard command after the HTTPRequest AND I Use mine AND have had success.
Using my example Above Procedure:
url = "br.linkedin.com/in/adrianoboller"
ok is boolean = HTTPRequest (Url)
IF ok = True
RETURN is string = WS_Android_IOS_HTTPGetResult()
END
Came No more Japanese, Korean OR Chinese code AND thus... |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 26 messages |
|
Posté le 20 novembre 2014 - 16:08 |
Thanks for the reply guys...
another question, Im using windows ce device and want to read a text file copied to the device. how will i determine automatically if that file is in ansi or unicode format. |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 651 messages Popularité : +175 (223 votes) |
|
Posté le 20 novembre 2014 - 21:39 |
Same Technique
IF StringCount(bufResHTTP, “ISO-8859-1”, IgnoreCase) = 0 THEN RESULT = UTF8ToString(TextBuffer) ELSE RESULT = AnsiToUnicode(TextBuffer) END |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 651 messages Popularité : +175 (223 votes) |
|
Posté le 20 novembre 2014 - 21:40 |
Procedure LE_ASCII(LOCAL ArquivoTxt)
PathFile is string = ArquivoTxt IdFile, ResCloseFile, FileID, NumeroLinha is int Line is string
FileID = fOpen(PathFile,foReadWrite) IF IdFile = -1 THEN Error(ErrorInfo(errMessage)) ELSE
Line = UnicodeToAnsi(fReadLine(FileID))
NumeroLinha = 1
WHILE Line <> EOT AND Line <> ""
NumeroLinha += 1 Line = fReadLine(FileID)
END IF Line = "" THEN Error(ErrorInfo(errMessage)) IF Line = EOT THEN Info("Final do Arquivo.") ResCloseFile = fClose(IdFile) IF ResCloseFile = -1 THEN
END
END |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 651 messages Popularité : +175 (223 votes) |
|
Posté le 20 novembre 2014 - 21:44 |
Change your project globally to ANSI
P (Big Yellow) -> popup Mouse Right -> Project Description -> Down Button: [ DESCRIBING THE CURRENT CONFIGURATION ] -> Guia Aba: UNICODE -> Check [x] ANSI -> OK -> OK
Re-test code... ok |
| |
| |
| | | |
|
| | |
| |
Posté le 20 novembre 2014 - 21:54 |
Hi
in what exactly is that another question? This looks exactly like the one I already answered to...
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
NEW: WXReplication, your open source replication system is available on my web site!!! WXShowroom.com: Show your projects! More information on http://www.fabriceharari.com
On 11/20/2014 10:08 AM, JOHNKEN wrote:
Thanks for the reply guys... another question, Im using windows ce device and want to read a text file copied to the device. how will i determine automatically if that file is in ansi or unicode format. |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 26 messages |
|
Posté le 21 novembre 2014 - 05:31 |
thanks adrianoboller, got it already |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 651 messages Popularité : +175 (223 votes) |
|
Posté le 21 novembre 2014 - 13:27 |
JOHNKEN
But he succeed?
If not send me a mini project to try to help you...
Att
Adriano |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 26 messages |
|
Posté le 21 novembre 2014 - 15:25 |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 651 messages Popularité : +175 (223 votes) |
|
Posté le 22 novembre 2014 - 12:50 |
Ok I will look today and give you a return Max until Monday
|
| |
| |
| | | |
|
| | |
| |
Posté le 19 février 2022 - 13:31 |
If you need to migrate your ansi file to unicode, then there is a manual method where you have to configure your ansi to your unicode via Import/export feature and then import your ansi file. You can also transfer your file through ansi To unicode Migration Tool and transfer your data easily.
Visit at : https://www.osttopstapp.com/ansi-to-unicode-pst.html |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 53 messages |
|
Posté le 23 février 2022 - 10:43 |
hi, I tried to use your procedure for maneg a respons from a websevice that has been giving me problems for some time to IOS, your solution works in the emulator but not on a real IOS smartphone. Have you ever tested it in production?
Procedure WS_Android_IOS_HTTPGetResult()
// Variable bufResHTTP is Buffer sHTTPResult is string
// Retrieves the result of the query bufResHTTP = HTTPGetResult(httpResult)
// Result in UTF8 em iOS Apple IF IniOSMode() = True OR IniOSSimulatorMode() = True OR IniOSEmulatorMode() = True IF StringCount(bufResHTTP, “ISO-8859-1”, IgnoreCase) = 0 THEN sHTTPResult = UTF8ToString(bufResHTTP) ELSE sHTTPResult = AnsiToUnicode(bufResHTTP) END ELSE IF InAndroidMode() = True OR InAndroidSimulatorMode() = True OR InAndroidEmulatorMode() = True // Result in Android sHTTPResult = bufResHTTP END
RESULT sHTTPResult
I haven't found a solution to my problem for months and your help would be greatly appreciated.
thanksMessage modifié, 23 février 2022 - 10:43 |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 4 messages |
|
Posté le 25 février 2022 - 13:41 |
the first 2 bytes contains a specific value in UNICODE mode. Be careful that there are several variants of Unicode (little endian, big endian...), so there may be several different header value to test.
You can of course check that out by using an Hexadecimal editor on your files. |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 4 messages |
|
Posté le 25 février 2022 - 13:45 |
Be careful that there are several variants of Unicode (little endian, big endian...), so there may be several different header value to test.
You can of course check that out by using an Hexadecimal editor on your files |
| |
| |
| | | |
|
| | |