Page 3 of 3

Re: Problem reading Unicode file

Posted: Mon Sep 15, 2014 5:36 pm
by mol
Kana wrote:I have code where I write XML file from DBF with

nHandle := FCreate( xmlfile, 0 ) )
...
FWRITE
...
FClose(

This function save ANSI XML file

I don't want convert file with notepad.exe or notepad++ from ANSI to UTF8
Is it posible to save UTF8 file from code?
It's better to convert all strings to utf8 immediately while creating xml tree, not convert whole file. It's my humble opinion only :-)

Re: Problem reading Unicode file

Posted: Tue Sep 16, 2014 1:17 pm
by Kana
mol wrote:It's better to convert all strings to utf8 immediately while creating xml tree, not convert whole file. It's my humble opinion only :-)
I do not have Unicode characters in the file. File has mostly numbers and only in the header file a brief description.
Server where I send file requests to be UTF8 otherwise denied.
So I'm looking for the easiest way to file is converted from ANSI to UTF8 because so far I have not written in UNICODE.

Re: Problem reading Unicode file

Posted: Tue Sep 16, 2014 4:09 pm
by mol
If you haven't use any utf-8 char, file in ANSI is the same as file saved in UTF8 format.
Try it by creating with notepad ansi file with basic characters:

Code: Select all

abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789
and convert it to utf8 format and save with differnet filename.

Both files are identical.

Basic characters are saved using 1 byte in UTF8 format.

Re: Problem reading Unicode file

Posted: Tue Sep 16, 2014 6:58 pm
by Kana
I think that I do not have any UTF-8 character, except '@' to display the mail address.

For some reason that's not clear to me the file is rejected with a message that is not in the prescribed format (UTF-8).
When I open this file with notepad.exe and record it as UTF-8 file after that send file without problems.

I can not now to test because now I have not access in the server but I do it next week.
Thanks for the advice and assistance.