[RESOLVED] Euro currency symbol in console displayed as question mark
Hello,
how can I display the € (EURo) sign instead of a question mark in a console application on german windows XP SP3 system?
(untested code due to lack of access to a XP system)
dim s as string
' even placing a € in the code displays just a question mark
s = strings.format("currenty test: Euro {0:c}", 42)
' EUR displayed as question mark
writeline(s)
readline
' EUR displayed as € sign
messagebox.show(s, "EUR", messageboxicon.error,messageboxbuttons.ok)
In the console, I can type AltGr + e to get an euro sign.
So the used console font (lucidia console I think) has the correct font.
Re: Euro currency symbol in console displayed as question mark
There is no code that allows certain characters technically speaking. What you need to do is change the font. If you get a ? then that means your font type does not support that character.
Normally when you enter a strange character into your code, the next time you save it you will get a prompt asking you if you wish to save your code in Unicode because you have special characters in it. You should click yes to this or else your Euro sign won't work.
Then, in whatever label or textbox your displaying the Euro in, change the font to a type that supports the Euro, such as "Arial Unicode MS".
Re: Euro currency symbol in console displayed as question mark
Quote:
Originally Posted by
Vectris
There is no code that allows certain characters technically speaking. What you need to do is change the font. If you get a ? then that means your font type does not support that character.
as I said, AltGr + e gives the € sign on the console prompt.
and writeline("{0:c}", 42) should print
'42,00 €' instead of '42,00 ?' in a console app.
Perhaps the used libraries are not fully locale aware, or a fresh german default installation is misconfigured in some way.
Re: Euro currency symbol in console displayed as question mark
You need to set the proper text encoding:
Code:
Console.OutputEncoding = System.Text.Encoding.UTF8
Re: Euro currency symbol in console displayed as question mark
Quote:
Originally Posted by
Atheist
You need to set the proper text encoding:
Code:
Console.OutputEncoding = System.Text.Encoding.UTF8
thanks, this line in my main() helped.