Results 1 to 5 of 5

Thread: [RESOLVED] Euro currency symbol in console displayed as question mark

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2009
    Posts
    4

    Resolved [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.

  2. #2
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    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".
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2009
    Posts
    4

    Re: Euro currency symbol in console displayed as question mark

    Quote Originally Posted by Vectris View Post
    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.

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    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
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2009
    Posts
    4

    Re: Euro currency symbol in console displayed as question mark

    Quote Originally Posted by Atheist View Post
    You need to set the proper text encoding:

    Code:
    Console.OutputEncoding = System.Text.Encoding.UTF8
    thanks, this line in my main() helped.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width