0

I am trying to print a currency symbol and am passing € for an euro to a third-party library that is doing some XSL transformation.

But the output is: €

It basically is translating & to &. I cannot return the correct output.

Is there any way I can construct the input such that I get an output of "€"?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user3101143
  • 137
  • 1
  • 3
  • 10
  • Take a look at [CDATA](http://www.w3schools.com/xml/xml_cdata.asp) – Lotok Dec 23 '13 at 21:30
  • 3
    You should not use or link to [w3schools](http://www.w3fools.com). It's not a reliable source of information and we don't want to encourage its use. I recommend using the [Mozilla Developer Network](https://developer.mozilla.org/en-US/) instead. – John Conde Dec 23 '13 at 21:43
  • Thanks @James. However, the transformation is happening in the 3rd party library hence if I pass "<![CDATA[€]]>", the output I get is "<![CDATA[&#x020AC;]]>" ... I wanted to know if my input can be formatted such a way that "&" is the putput and not " " – user3101143 Dec 23 '13 at 21:46
  • 1
    I think it would be helpful to know where you input the data. Please, provide more information and some code, otherwise all we can do is guessing. – Carlo Cannas Dec 23 '13 at 21:48
  • Hi @CarloCannas, there is a 3rd party library say, FileCreator My code looks like the lines below; please note that i would not be able to massage the output; hence would need to format my input such a way that the & are not parsed as & FileCreator.setInput("myInput"); FileCreator.createFile("c:\myfile.html"); ==Output== <b>myInput<b> – user3101143 Dec 23 '13 at 22:05
  • 1
    @user3101143 unless you provide us the relevant code in order to reproduce the problem, we cannot help you. Also, don't provide it in the comments, edit the question. – Carlo Cannas Dec 23 '13 at 22:09
  • 1
    Can you not pass € literally ? It looks liek your library is escaping for you – Noggin Head Dec 23 '13 at 22:47
  • @NogginHead, you almost hit the bullseye .... I actually am generating an MS Excel file with the currencies and if you see the file I generated (http://tinyurl.com/currencytestxls), opening it in the text editor shows the correct symbol but somehow, MS Excel does not display the symbol. I am guessing there is some issue with the encoding. – user3101143 Dec 23 '13 at 23:48
  • 1
    On the surface, it looks as if the third party library has a bug. So you either have to get them to fix it, or stop using that library. – Michael Kay Dec 24 '13 at 07:54
  • If you are coming from a search engine result just looking for how to escape "&" in HTML (e.g., using "escape ampersand HTML"), see e.g. [this answer to *How can I escape "&" in XML?*](https://stackoverflow.com/questions/12524908/how-can-i-escape-in-xml/12524951#12524951) (they also apply to HTML, at least for "&"). What is the Stack Overflow canonical question for HTML only? – Peter Mortensen Nov 08 '21 at 22:56

2 Answers2

0

You haven't told us what the library is, but I'm guessing that it just expects non-escaped Unicode... in which case, as Noggin Heads said, you should pass the € character in and trust the system to do the right thing.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
keshlam
  • 7,931
  • 2
  • 19
  • 33
0

Since it appears to be escaping characters on its own, just type the character and see if it escapes.

undecim
  • 111
  • 4