PDA

View Full Version : Is this ASCII, ANSI, UNICODE or something else?



martin
27-04-2009, 14:01
Dear Thinbasic experts,

If I run the code below, It outputs wrong characters (Í ÷ Ú). How can I display the correct characters?

uses "console"
printl "Ö ö é"
console_waitkey


if I use MSGBOX instead of PRINTL everything is displayed correct, but I want this to display correct in a console too.

Thanks in advance for your help

Martin

ErosOlmi
27-04-2009, 14:45
Martin,

we are checking. From the tests we are making it seems we have a problem in the compiler we are using.
We are making further testing and if confirmed we will send a request to our compiler support help desk.

Eros

martin
27-04-2009, 15:45
Thanks for letting me know Eros. It also doesn't work correctly with FILE_LinePrint. But maybe I can temporarely solve that by replacing those characters with others.

Greetings,

Martin

martin
27-04-2009, 16:11
whoohoo it seems to work fine with saving in Binary mode, so I can use that.

ErosOlmi
27-04-2009, 16:52
Martin,

our supposition is that problem seem definitely in compiler and how it treats string literals constants (strings inside double quotes).
It seems to apply always code page 1252 instead of the local code page, in my case 850.

I'm not 100% sure about the above, we are still testing but from all our tests it seems confirmed.

We also think to have found a work around that is to load source code as ascii, transform it into unicode and back to ascii but now forcing code page 850. So when thinBasic loads source code files it will now perform something like:

ScriptSourceCode = ACode$(UCode$(ScriptSourceCode), 850)

_________________________________________________
Can you please test thinCore.dll and see if it solves the problem?
You need latest thinBasic beta 1.7.8.0 installed.
Than keep attached thinCore.dll and place it in \thinBasic\ directory replacing your current one.

If than you can confirm if this solves the problem we can definitely send a support request to Power Basic.
If this thinCore.dll does not resolve the problem we have to search somewhere else.

Thanks
Eros

PS: attention, with this thinCore.dll you cannot create correct bundled exe but you have to wait next thinBasic update.

martin
27-04-2009, 18:09
Hi Again,

I replaced the corefile and then checked only these evil characters: Ö, ö and é but it doesn't solve the problem  :diablo:

In the console it displays:
Ö as ö (lowercase)
ö as " (which generate an error: "Unrecognized or unsupported char")
é correctly as é

With FILE_LinePrint:
The same problem with ö ("Unrecognized or unsupported char")
Ö is converted to™
and é to ‚

I hope this information is helpfull to you.

Martin

ErosOlmi
28-04-2009, 15:54
Martin,

forget my previous post with thinCore.dll

Can you please try to add the following line to the script:


console_setoutputcp(1252)

And see what happen?

Thanks
Eros

martin
28-04-2009, 16:27
Ciao Eros, I did but I still get wrong output

ErosOlmi
28-04-2009, 16:53
Here that line solves the problem :?

Can you please check with code page you have as default one?
You can do that using something like:


USES "CONSOLE"
printl console_Getoutputcp
waitkey

martin
28-04-2009, 18:51
the result of console_Getoutputcp is: 850

ErosOlmi
28-04-2009, 21:19
Martin,

I'm sorry to ask you to test so many times but this problem is new to me.
Here in my box all seems working fine but in my computer I was using a truetype font for console output: LucidaConsole.

Can you be so kind to run the following script.


uses "console"

printl "Starting code page...........: ", console_getoutputcp
printl "Testing string with this CP..: ", "אטילעש"
printl string$(60, "-")
printl "Changing code page to 1252...: ", console_setoutputcp(1252)
printl "New code page................: ", console_getoutputcp
printl "Testing string with this CP..: ", "אטילעש"
printl string$(60, "-")
printl "<Press any key to finish>"

waitkey


When it will be on screen waiting for you to press a key, than change console window properties changing font from raster to some true type like Lucida Console.
Done that, can you please confirm if you still see incorrect text or not?

Thanks
Eros

martin
29-04-2009, 09:15
Good morning Eros,

This works! I can see the correct text now :D


Starting code page...........: 850
Testing string with this CP..: אטילעש
------------------------------------------------------------
Changing code page to 1252...: 1
New code page................: 1252
Testing string with this CP..: אטילעש
------------------------------------------------------------
<Press any key to finish>


Also writing the string "אטילעש" to a textfile with FILE_LINEPRINT works fine now!

Martin

ErosOlmi
29-04-2009, 09:56
Thank you very much for testing :)

Now I need to better understand what's going on under the curtains :diablo: