ReadLine and special character like accent
BlitzMax Forums/BlitzMax Beginners Area/ReadLine and special character like accent
| ||
I all ! I just can read the special character that my file have like accent ιθ ... etc even if my file is declared as string it does't matter. It return me other kind of char, why I can't read these character? do I need to code exception and convert them on the fly? thanks |
| ||
ok, presumably you are testing the output via the IDE console, it appears that the console in the IDE doesn't support unicode characters. Although BMax can read and write unicode without issue. Local File = OpenFile("testin.txt") Local file2 = WriteFile("testout.txt") If Not file RuntimeError "could not open file openfile.bmx" While Not Eof(file) Local a$ = ReadLine(file) WriteLine(file2, a$) Wend CloseStream file CloseStream file2 |
| ||
Ahh I just tested.. humm thanks :) ... well if bmax gui come out I hope it will support unicode because bmax ide was made by bmax so... |
| ||
Does loadfont and drawtext support unicode chars? In my tests write line dosn't support utf16 files. Did I just screw it up? |
| ||
This problem happens when using PRINT statement, under WINDOWS. there's a way to solve it: Type ANSI function Print(Str:String = "") standardiostream.writebytes(str.tocstring(),len(str)) End Function Function PrintLine(str:String = "") local LineFeed:String = chr(13) + chr(10) str = str + linefeed standardiostream.writebytes(str.tocstring(),len(str)) End Function end type This is a sample program: Type ANSI function Print(Str:String = "") standardiostream.writebytes(str.tocstring(),len(str)) End Function Function PrintLine(str:String = "") local LineFeed:String = chr(13) + chr(10) str = str + linefeed standardiostream.writebytes(str.tocstring(),len(str)) End Function end type ansi.printline ("Print ansi characters without conversion to UTF8. αινσϊ") input Using ANSI.Print or ANSI.PrintLine will disable the conversion of chars to UTF8, leaving the standar windows text format (usually ANSI). If you want to keep cross-platform compatibility you can also use BLIde (an alternative BlitzMax IDE) wich supports unicode characters in its console window. |