• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

$ symbol not displayed properly in excel

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using POI API to generate an Excel file from java. But, $ symbol is replaced by a weired character in the cells.

What shall be the reason behind it?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't notice problems with having a $ character in a string field. What code are you using to create the file? Post a SSCCE.
 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to inform you that $ symbol is displayed properly on my local machine. but, the same code is deployed in the production environment and there its showing weird symbol �.

i did some research on this symbol and found out that this symbol denote a currency when the symbol for a particular currency is unavailable.

then i go through the source code and found out the below lines of code:

NumberFormat formatter = NumberFormat.getCurrencyInstance();
cell.setCellValue(formatter.format(cost));

This number format returns a currency format for the current default locale. So, i guess, the locale setting for currency in the production environment is changed.

But, i dont have access to production environment. So, my manager has asked me to replicate this issue on my local system by changing the locale setting of windows xp.

i go to control panel -> Regional and Language Options. In the Regional Options tab, i click on customize button and Customize Regional Options dialog box opens. In the Currency tab of this dialog box, i changed the currency symbol to �. And then save the changes.

Then i restart the machine and start our project server. But, on my local machine its still displaying the $ symbol in the excel file. i am not able to replicate the issue.

Please guide me friend to resolve this issue.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So the issue is not about the "$"not being displayed properly, but about NumberFormat.getCurrencyInstance returning something other than what was expected.

In that case I'd use NumberFormat.getCurrencyInstance(Locale) to request the currency symbol of whatever locale is being used.
 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Ulf, we can use NumberFormat.getCurrencyInstance(Locale.US) to request the $ currency symbol.

but, the problem is i can't change code in the production environment and test it there directly. so, i need to replicate the issue on local system. for that, i tried the steps mentioned in my previous post. but it doesn't work.

please help me out.

Note: at the start of this topic, i asked a problem, for which we have a solution now. but the problem is only after i replicate the issue on my local machine, my manager will approve my changes to the production.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For these purposes one needs a machine that mimics the production machine in every aspect. That should be part of the development/testing pipeline anyway. Developer's machines are never the same as production machines to begin with, so what does or does not happen on them is of little consequence.

What's important is that you know what the problem is, and that your code change fixes it. If your manager then doesn't approve it, and won't get you a replica of the server machine for testing, that's his problem; your work is done.
 
Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic