02.08.2010, 22:00
(
Последний раз редактировалось dax123; 02.08.2010 в 22:18.
Причина: syntax correction
)
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:
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:
so here is the question:
do you guys have a way to avoid UTF-8 character corruption with fwrite function?
thanks in advance.
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 );
Код:
Њ*№цАЗ БЂГҐА» БцБЂЗХЋПЋЩ.
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 ;
}
do you guys have a way to avoid UTF-8 character corruption with fwrite function?
thanks in advance.