Problem reading Unicode file

HMG Unicode versions 3.1.x related

Moderator: Rathinagiri

User avatar
mol
Posts: 2834
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 118 times
Been thanked: 63 times
Contact:

Re: Problem reading Unicode file

Post by mol » Mon Sep 15, 2014 5:36 pm

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 :-)

Kana
Posts: 27
Joined: Sun Feb 07, 2010 2:48 pm

Post by Kana » Tue Sep 16, 2014 1:17 pm

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.

User avatar
mol
Posts: 2834
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 118 times
Been thanked: 63 times
Contact:

Post by mol » Tue Sep 16, 2014 4:09 pm

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.

Kana
Posts: 27
Joined: Sun Feb 07, 2010 2:48 pm

Post by Kana » Tue Sep 16, 2014 6:58 pm

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.

Post Reply