• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NumberFormat

 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I run the example for French Locale as mentioned http://java.sun.com/docs/books/tutorial/java/data/numberFormat.html , the output is displayed as

123�456 fr_FR


rather than

345 987,246 fr_FR

Why is '�' displayed?
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to view it in the command prompt (or in Unix shell).
Try to redirect the output to a file and open it using Notepad and see how it looks.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mani Ram:
Are you trying to view it in the command prompt (or in Unix shell).
Try to redirect the output to a file and open it using Notepad and see how it looks.


Well it works when I redirect it to a file but why doesn't it work with command prompt?
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably the space between 123 and 456 is not a normal space, but some special character, which the DOS prompt is unable to render properly.
How does the Euro (�) symbol appear in the command prompt and how does it appear in the notepad? DOS character set is different from the ANSI character set.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mani Ram:
Probably the space between 123 and 456 is not a normal space, but some special character, which the DOS prompt is unable to render properly.
How does the Euro (�) symbol appear in the command prompt and how does it appear in the notepad? DOS character set is different from the ANSI character set.


What is the Locale for Euro?
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Germany (DE).
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
9.876.543,21 � de_DE
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:


And if you try to redirect it to a file and open it in notepad, you will see


Is it clear now? The DOS window is incapable of displaying some ANSI characters.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what I am getting in the file

 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Out of curiosity, have you tried switching the font you use for the command prompt or shell? Perhaps it's merely the font and not something inherent in cmd.exe itself.
 
Arjun Shastry
Ranch Hand
Posts: 1898
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting the correct output on command prompt.I am using Lucida Console fonts on command prompt.
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not getting the correct output even with Lucida Console font!
 
Arjun Shastry
Ranch Hand
Posts: 1898
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pradeep,
define locale as :

rather than

If you print the avaiable Locales,you will know actual values.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Arjun Shastry:
Pradeep,
define locale as :

rather than

If you print the avaiable Locales,you will know actual values.


It doesn't work. Expected output



What I get by using
is
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Loocales are specified using two-letter abbreviations for language and country. You had it right the first time.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic