Unicode text string problems

Blitz3D Forums/Blitz3D Programming/Unicode text string problems

(tu) ENAY(Posted 2007) [#1]
Hi,

I'm having trouble writing to a unicode file in Blitz.

Ok, as an example if I readbyte one character at a time from a unicode text file, and then create a new file and to the exact opposite. I successfully have a copy of the original unicode text file.

But if I try to modify the contents or create the same file again in code using the exact same ascii, it gets saved out as a normal text which makes things go corrupt.

Are there are any unusual things I should be aware about in Blitz's Read/Write file routines that could be causing this?

If I create an empty file it's always an ANSI text file, how can I create an empty Unicode file?

I think what I'm trying to look for is a WriteFile/WriteUnicodeFile function.


big10p(Posted 2007) [#2]
I'm not familiar with the unicode text file format, but it sounds like you may be missing some formatting data or possibly using the wrong endianess for the characters, or something. Just a guess. This any help?


DJWoodgate(Posted 2007) [#3]
Wikipedia has quite a lot on it. http://en.wikipedia.org/wiki/UTF-16
Looks like there quite a few unicode encoding schemes. Nothing is ever straightforward.


(tu) ENAY(Posted 2007) [#4]
Thanks for the tips guys. Although I think it's just Blitz that has problems with Unicode. Many characters show up in the IDE as questions marks when you try to copy and paste them in and during execution they pop up as squares.
I've developed a way around it though, by having characters in a non unicode file and then converting the text strings later.