Radline and special chars
BlitzMax Forums/BlitzMax Beginners Area/Radline and special chars
| ||
(Topic should read "READLINE") Hmm I have trouble reading nordic chars with readline$ Æ Ø and Å are returned as rubbish (and as two chars each), I read from a standard txt-file... This worked fine in B3D Anyone ? |
| ||
Try using a TTextStream...myStream:TStream = openStream("utf8::myTextFile.txt", true, false) ?? |
| ||
It looks like the characters themselves are actually being read fine, but the different ways of outputting text in BlitzMax are handling them with varying degrees of success (TextArea works; Print and DrawText don't). Using this test program:Strict Local win:TGadget = CreateWindow("", 0,0, 500,250) Local can:TGadget = CreateCanvas(0,0, 490,100, win) Local txt:TGadget = CreateTextArea(0,105, 490,80, win) SetGraphics CanvasGraphics(can) Print Local in:TStream = ReadStream("test.txt") Local line = 12 While Not Eof(in) Local a$ = ReadLine(in) Print a DrawText a, 0, line line :+ 12 AddTextAreaText(txt, a+"~n") Wend Flip Repeat WaitEvent Until EventID()=EVENT_WINDOWCLOSE CloseStream in And this "test.txt": I have trouble reading nordic chars with readline$ Æ Ø and Å are returned as rubbish (and as two chars each), I read from a standard txt-file... Produces three different results with Print, DrawText, and a TextArea gadget: ![]() Others have mentioned the differing degrees of support before, for example here: http://blitzbasic.com/Community/posts.php?topic=65667 I tried replacing Local in:TStream = ReadStream("test.txt") with Ian's Local in:TStream = OpenStream("utf8::test.txt", True, False) but that made everything wrong: ![]() It could be that Ian's on the right track, though, and perhaps there's some way to get it working for Print. DrawText could perhaps be cleared up for Nordic chars by using a more-inclusive/Unicode(?) font (as Brucey mentions for Cyrillic in the thread above). |
| ||
You need to be using a unicode font with DrawText (I use tahoma for testing), that default embedded blitzfont isn't going to cut it. The output window of MaxIDE will hopefully be fixed in future. Firefox just died on me reading this thread so more unicode issues there also I suspect. |
| ||
Thank's all :o) |