Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Displaying Euro Symbol

Reply
Thread Tools

Displaying Euro Symbol

 
 
=?Utf-8?B?U2FsYW1FbGlhcw==?=
Guest
Posts: n/a
 
      12-13-2004
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
 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      12-13-2004
Hi, SalamElias

Take a look at this sample code :

http://msdn.microsoft.com/library/de...ficculture.asp



Juan T. Llibre
===========
"SalamElias" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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



 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2FsYW1FbGlhcw==?=
Guest
Posts: n/a
 
      12-13-2004
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/de...ficculture.asp
>
>
>
> Juan T. Llibre
> ===========
> "SalamElias" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >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

>
>
>

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-14-2004
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.)

 
Reply With Quote
 
Joerg Jooss
Guest
Posts: n/a
 
      12-19-2004
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
http://www.velocityreviews.com/forums/(E-Mail Removed)


 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-20-2004
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.)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Euro currency symbol David Wright Ruby 4 03-31-2009 04:05 PM
Euro Symbol... Pancho Computer Support 14 03-31-2007 03:29 PM
HtmlEncode and Euro Symbol Victor ASP .Net 0 07-19-2006 05:09 PM
Euro Symbol Key noelogara@hotmail.com Computer Support 1 05-04-2006 09:57 PM
what's differnece between #ifdef symbol and #if defined(symbol) baumann@pan C Programming 1 04-15-2005 08:25 AM



Advertisments