Displaying Euro Symbol

Discussion in 'ASP .Net' started by =?Utf-8?B?U2FsYW1FbGlhcw==?=, Dec 13, 2004.

  1. I followed instructions in MSDN help articles and wrotethe folowing code in
    order to display numeric numbers with Euro symbol as follows :
    ----------------------------
    Dim OutString As [String] = ""
    Dim frCulture As New CultureInfo("fr-FR", False)
    Thread.CurrentThread.CurrentCulture = frCulture
    Dim myCurrency As New [Decimal](123456)
    myCurrency.ToString("C", LocalFormat)
    OutString = "Euro : " + myCurrency.ToString("C",
    NumberFormatInfo.CurrentInfo)
    -----------------------------
    Instead of getting
    Euro : 123.456,00 €
    The page is displaying
    Euro : 123.456,00 ?
    Am I missing a parameter somewhere?
    Thanks
    =?Utf-8?B?U2FsYW1FbGlhcw==?=, Dec 13, 2004
    #1
    1. Advertising

  2. Hi, SalamElias

    Take a look at this sample code :

    http://msdn.microsoft.com/library/d...onformattingnumericdataforspecificculture.asp



    Juan T. Llibre
    ===========
    "SalamElias" <> wrote in message
    news:...
    >I followed instructions in MSDN help articles and wrotethe folowing code in
    > order to display numeric numbers with Euro symbol as follows :
    > ----------------------------
    > Dim OutString As [String] = ""
    > Dim frCulture As New CultureInfo("fr-FR", False)
    > Thread.CurrentThread.CurrentCulture = frCulture
    > Dim myCurrency As New [Decimal](123456)
    > myCurrency.ToString("C", LocalFormat)
    > OutString = "Euro : " + myCurrency.ToString("C",
    > NumberFormatInfo.CurrentInfo)
    > -----------------------------
    > Instead of getting
    > Euro : 123.456,00 ?
    > The page is displaying
    > Euro : 123.456,00 ?
    > Am I missing a parameter somewhere?
    > Thanks
    Juan T. Llibre, Dec 13, 2004
    #2
    1. Advertising

  3. I is from this article I constructed my code. After I have posted my mail, I
    rememebered that I gave changed the encoding in web.config from
    <globalization fileEncoding="utf-8" requestEncoding="utf-8"
    responseEncoding="utf-8"/>
    To <globalization fileEncoding="ISO-85....." requestEncoding="ISO-85......."
    responseEncoding="ISO-85........"/>
    I swithed back to urf-8, now the Euro symbol displaying correctly.

    Any ideas of why this?
    Thanks
    "Juan T. Llibre" wrote:

    > Hi, SalamElias
    >
    > Take a look at this sample code :
    >
    > http://msdn.microsoft.com/library/d...onformattingnumericdataforspecificculture.asp
    >
    >
    >
    > Juan T. Llibre
    > ===========
    > "SalamElias" <> wrote in message
    > news:...
    > >I followed instructions in MSDN help articles and wrotethe folowing code in
    > > order to display numeric numbers with Euro symbol as follows :
    > > ----------------------------
    > > Dim OutString As [String] = ""
    > > Dim frCulture As New CultureInfo("fr-FR", False)
    > > Thread.CurrentThread.CurrentCulture = frCulture
    > > Dim myCurrency As New [Decimal](123456)
    > > myCurrency.ToString("C", LocalFormat)
    > > OutString = "Euro : " + myCurrency.ToString("C",
    > > NumberFormatInfo.CurrentInfo)
    > > -----------------------------
    > > Instead of getting
    > > Euro : 123.456,00 ?
    > > The page is displaying
    > > Euro : 123.456,00 ?
    > > Am I missing a parameter somewhere?
    > > Thanks

    >
    >
    >
    =?Utf-8?B?U2FsYW1FbGlhcw==?=, Dec 13, 2004
    #3
  4. Hi SalamElias,

    Thanks for your posting. I think the problem you mentioned is because the
    "€" symbol which could be displayed correctly under UTF-8 encoding but
    failed under "ISO-8859-1" is because
    "€" is a three-bytes-character which can't be represented by ISO-8859-1(
    Latin-1) charset, the ISO-8859-1 can only represent the standard
    one-byte-charaters(0-127 is the standard ASCII CHARS). We can use the
    following code to verify this;

    Dim myCurrency As New [Decimal](123456)



    Thread.CurrentThread.CurrentCulture = frCulture


    Dim str As String = myCurrency.ToString("C",
    NumberFormatInfo.CurrentInfo)
    Dim flag As Char = str.Chars(str.Length - 1)

    Response.Write("<br>" + flag.ToString())

    Dim bytes() As Byte =
    System.Text.Encoding.UTF8.GetBytes(flag.ToString())

    Response.Write("<br>length: " & bytes.Length)

    the length will return 3 indicate that it is a multi-bytes char.

    If there is anything unclear, please feel free to post here. Thanks.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    Steven Cheng[MSFT], Dec 14, 2004
    #4
  5. =?Utf-8?B?U2FsYW1FbGlhcw==?=

    Joerg Jooss Guest

    Steven Cheng[MSFT] wrote:
    > Hi SalamElias,
    >
    > Thanks for your posting. I think the problem you mentioned is because
    > the "€" symbol which could be displayed correctly under UTF-8
    > encoding but failed under "ISO-8859-1" is because
    > "€" is a three-bytes-character which can't be represented by
    > ISO-8859-1( Latin-1) charset, the ISO-8859-1 can only represent the
    > standard one-byte-charaters(0-127 is the standard ASCII CHARS). We
    > can use the following code to verify this;


    There's no concept of multibyte characters in ISO-8859-x -- these are simply
    8 bit encodings, and ISO-8859-1 simply doesn't ccontain €. It is contained
    in ISO-8859-15, but using UTF-8 should be the preferred solution anyway.

    Cheers,

    --
    Joerg Jooss
    www.joergjooss.de
    Joerg Jooss, Dec 19, 2004
    #5
  6. Hi Joerg,

    Thanks a lot for your correction. Yes, I think I've mistaken the "€" char
    for a multi-bytes one. Your point on the ISO-8859-x highlight this. Thank
    again for your input.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    Steven Cheng[MSFT], Dec 20, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Victor

    HtmlEncode and Euro Symbol

    Victor, Jul 19, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,249
    Victor
    Jul 19, 2006
  2. baumann@pan
    Replies:
    1
    Views:
    742
    Richard Bos
    Apr 15, 2005
  3. Song Ma
    Replies:
    2
    Views:
    226
    Charles Oliver Nutter
    Jul 20, 2008
  4. David Wright

    Euro currency symbol

    David Wright, Mar 31, 2009, in forum: Ruby
    Replies:
    4
    Views:
    216
    kungfu-free
    Mar 31, 2009
  5. Replies:
    6
    Views:
    1,767
Loading...

Share This Page