I have an app where the user is creating a ‘tender item’ that our company publishes to the public in which anyone can view and then bid upon.
When our internal users create this item, they often copy and paste ‘work requirements’ into a field that are later used in a dynamically generated .html page.
I am having encoding issues with some of the chars, and don’t know how to get them to render correctly.
Specifically:
A short dash is fine (‘-‘), however there is a longer dash (‘–’) that displays like this: –
Also, I am having trouble with certain single and double quotes, which are giving me this: ’, –, “, and â€.
What do I need to do to fix this?
The app simply reads in this info from a session var, and then I create the html page from there. I have tried to put
`<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />`
in the head, but this does not help. I have also tried (stab in the dark) to feed the string into a byte array and encoding the array to UTF-8 (thinking that maybe it was from the source?), but this also didn’t help. Once the page is rendered, I check the encoding and it is presented in Western European (ISO).
You’re going to need to find a way print the raw HTML Character codes when a user inputs a certain character. For an EM dash, use
—, etc.