| |
Registered member 26 messages |
|
Posted on November, 20 2014 - 2:41 PM |
How to detect if the text file you are accessing/opening is ansi or unicode format? |
| |
| |
| | | |
|
| | |
| |
Posted on November, 20 2014 - 3:04 PM |
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 onhttp://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? |
| |
| |
| | | |
|
| | |
| |
Registered member 3,659 messages Popularité : +175 (223 votes) |
|
Posted on November, 20 2014 - 3:20 PM |
ProcedureWS_Android_IOS_HTTPGetResult()
bufResHTTP is Buffer sHTTPResult isstring
bufResHTTP=HTTPGetResult(httpResult)
IFIniOSMode() =TrueORIniOSSimulatorMode() =TrueORIniOSEmulatorMode() =True IFStringCount(bufResHTTP, “ISO-8859-1”,IgnoreCase) =0THEN sHTTPResult=UTF8ToString(bufResHTTP) ELSE sHTTPResult=AnsiToUnicode(bufResHTTP) END ELSE IFInAndroidMode() =TrueORInAndroidSimulatorMode() =TrueORInAndroidEmulatorMode() =True
sHTTPResult=bufResHTTP END
RESULTsHTTPResult > |
| |
| |
| | | |
|
| | |
| |
Registered member 3,659 messages Popularité : +175 (223 votes) |
|
Posted on November, 20 2014 - 3:28 PM |
JOHNKEN
I work with Windev Mobile setIN[x]ANSIGLOBALproject
I had to make this overallProcedurefor making the identification was coming up theRETURNof theHTTPRequestwith UnicodeORANSIINHTTPGetResult,I stopped using the standard command after theHTTPRequestANDIUsemineANDhave had success.
Using my exampleAboveProcedure:
url="br.linkedin.com/in/adrianoboller"
ok isboolean=HTTPRequest(Url)
IFok=True
RETURNisstring=WS_Android_IOS_HTTPGetResult()
END
CameNomore Japanese,KoreanORChinese codeANDthus... > |
| |
| |
| | | |
|
| | |
| |
Registered member 26 messages |
|
Posted on November, 20 2014 - 4:08 PM |
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. |
| |
| |
| | | |
|
| | |
| |
Registered member 3,659 messages Popularité : +175 (223 votes) |
|
Posted on November, 20 2014 - 9:39 PM |
Same Technique
IFStringCount(bufResHTTP, “ISO-8859-1”,IgnoreCase) =0THEN RESULT=UTF8ToString(TextBuffer) ELSE RESULT=AnsiToUnicode(TextBuffer) END > |
| |
| |
| | | |
|
| | |
| |
Registered member 3,659 messages Popularité : +175 (223 votes) |
|
Posted on November, 20 2014 - 9:40 PM |
ProcedureLE_ASCII(LOCALArquivoTxt)
PathFile isstring=ArquivoTxt IdFile,ResCloseFile,FileID,NumeroLinha isint Line isstring
FileID=fOpen(PathFile,foReadWrite) IFIdFile= -1THEN Error(ErrorInfo(errMessage)) ELSE
Line=UnicodeToAnsi(fReadLine(FileID))
NumeroLinha=1
WHILELine<>EOTANDLine<>""
NumeroLinha+=1 Line=fReadLine(FileID)
END IFLine=""THENError(ErrorInfo(errMessage)) IFLine=EOTTHENInfo("Final do Arquivo.") ResCloseFile=fClose(IdFile) IFResCloseFile= -1THEN
END
END > |
| |
| |
| | | |
|
| | |
| |
Registered member 3,659 messages Popularité : +175 (223 votes) |
|
Posted on November, 20 2014 - 9:44 PM |
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 |
| |
| |
| | | |
|
| | |
| |
Posted on November, 20 2014 - 9:54 PM |
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 onhttp://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. |
| |
| |
| | | |
|
| | |
| |
Registered member 26 messages |
|
Posted on November, 21 2014 - 5:31 AM |
thanks adrianoboller, >got it already |
| |
| |
| | | |
|
| | |
| |
Registered member 3,659 messages Popularité : +175 (223 votes) |
|
Posted on November, 21 2014 - 1:27 PM |
JOHNKEN
But he succeed?
If not send me a mini project to try to help you...
Att
>Adriano |
| |
| |
| | | |
|
| | |
| |
Registered member 26 messages |
|
Posted on November, 21 2014 - 3:25 PM |
| |
| |
| | | |
|
| | |
| |
Registered member 3,659 messages Popularité : +175 (223 votes) |
|
Posted on November, 22 2014 - 12:50 PM |
Ok I will look today and give you a return Max until Monday
> |
| |
| |
| | | |
|
| | |
| |
Posted on February, 19 2022 - 1:31 PM |
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> |
| |
| |
| | | |
|
| | |
| |
Registered member 55 messages |
|
Posted on February, 23 2022 - 10:43 AM |
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 modified, February, 23 2022 - 10:43 AM |
| |
| |
| | | |
|
| | |
| |
Registered member 4 messages |
|
Posted on February, 25 2022 - 1:41 PM |
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. |
| |
| |
| | | |
|
| | |
| |
Registered member 4 messages |
|
Posted on February, 25 2022 - 1:45 PM |
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 |
| |
| |
| | | |
|
| | |