Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert ISO-8859-1 to utf-8

Status
Not open for further replies.

stinkybee

Programmer
May 15, 2001
218
GB
After hours of searching I have decided I perhaps should use Tek-Tips to hopefuly find an answer to this.

I have an XML file that is encoded in ISO-8859-1. When I open this in a browser everything is fine. In particular £(GBP signs) which is my main concern.

When I load the xml page via an ASP script and view the contents all of the "£" signs have changed to "�" as well as some other special characters.

How do I get these characters to display correctly. I also need to enter them into a database.

I have had this issue many times over the years but it has been solved by making sure all pages are set to utf-8. What can I do to change the ISO-8859-1 encoding to UTF-8 after the XML file has been loaded.

I have tried programmatically changing the encoding of the XML file to utf-8 but this gives me the a question mark in a black diamond instead of the correct characters.

Thanks in advance for any help on this issue

Web Development Manager
 
Why not give resulting document URL a UTF-8 CharSet header?

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
I have an XML file that is encoded in ISO-8859-1.
Interesting.
When I load the xml page via an ASP script and view the contents all of the "£" signs have changed to "�" as well as some other special characters.
Sounds more like UTF-8 not correctly interpreted.
Is the XML truly ISO 8859-1 encoded? Open it in Notepad++ and click the "encoding" menu item. Does it say ANSI?
What can I do to change the ISO-8859-1 encoding to UTF-8 after the XML file has been loaded.
What you can do is set the ASP session encoding to UTF-8:
Code:
Session.CodePage=65001
Then, of course, the encoding of your XML must be utf-8 too. If you open it in Notepad++ you can click "Encoding->Convert to UTF-8 without BOM".

Cheers,
MakeItSo

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
I have opened it in Notepad++ but nothing is selected in the encoding menu. When converting it to UTF-8 without BOM it works.

Of course the problem is that I need all of this automated, in other words I do not want to download the XML file, convert it in Notepadd++, upload the XML file, then run the script.

Is there anything I can do to convert it via a script?

Web Development Manager
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top