fwrite() - asian characters broken
#1

I'm using korean version of windows and having a problem with scripting
I write a file to scriptfiles folder and I try to verify it with notepad,
if I use fwrite() function it just writes any korean character broken(or asian characters whatever..that requires UTF-
for example:
pawn Код:
new File:temp;
temp = fopen( "sample.txt", io_write );
fwrite( temp, "서버의 정책을 지정합니다." ) // which means 'assigning a policy for a server' for korean
fclose( temp );
and when I open the sample.txt it shows the characters like:
Код:
Њ*№цАЗ БЂГҐА» БцБЂЗХЋПЋЩ.
even when I open the text file with UTF-8 encoding the characters were still corrupted.
traditional workarounds like re-formatting( format(text,sizeof(text),"%s",text); )or using fixchars() function didn't work either.
but when I use fputchar() and set the utf8 argument to false then it shows fine in notepad.
so I had to make a workaround function like this:
pawn Код:
stock c_fwrite( File: handle, const string[] )
{
    for( new i = 0; i < strlen( string );  i++ ) fputchar( handle, string[i], false);
    return ;
}
so here is the question:
do you guys have a way to avoid UTF-8 character corruption with fwrite function?
thanks in advance.
Reply


Messages In This Thread
fwrite() - asian characters broken - by dax123 - 02.08.2010, 22:00
Re: fwrite() - asian characters broken - by dax123 - 03.08.2010, 05:24
Re: fwrite() - asian characters broken - by bigcomfycouch - 03.08.2010, 05:47
Re: fwrite() - asian characters broken - by dax123 - 03.08.2010, 07:09
Re: fwrite() - asian characters broken - by dax123 - 03.08.2010, 07:30
Re: fwrite() - asian characters broken - by bigcomfycouch - 03.08.2010, 07:57
Re: fwrite() - asian characters broken - by dax123 - 06.08.2010, 00:44
Re: fwrite() - asian characters broken - by XPlatform - 06.08.2010, 06:14
Re: fwrite() - asian characters broken - by Souvlaki - 06.08.2010, 06:44
Re: fwrite() - asian characters broken - by dax123 - 06.08.2010, 22:30

Forum Jump:


Users browsing this thread: 1 Guest(s)