troubleshooting Question

special characters not displaying correctly in browser

Avatar of mktgweb
mktgweb asked on
Web Languages and StandardsWeb DevelopmentASP.NET
1 Comment1 Solution991 ViewsLast Modified:
I am using a webservice to get a list of places. The places (country, state, and city) are being returned via xml in utf-8 format. When I view the places in visual studio in a browser, all of the special characters do not display correctly, e.g. umlauts, accents, etc. For example some German and south american names. For example, I get Córdoba (not the o with an accent).   How can I convert these strings to display correctly on the web using c#.   Encoding.Convert?  convert to byte array? decode?

So, I am setting a string to hold all the returned xml, after which I pull out the places names I need into a dropdown list:
string placesList = this.Servicecall("places", new NameValueCollection { { "prettyprint", "0" }, { "out", "xml" }, { "geo", "0" } });

If you look at my attached code, I am hoping there is some simply way of using a c# function to correctly "decode" the returned xml text. So after lines 33, 38 and 42 where I set the city, state and country text.

I put this meta tag in the head, but it didn't help:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

I also already have ResponseEncoding="utf-8" in the <%@ Page %> tag, which didn't fix this either.

Thanks
placesshortened.txt
placesfunction.txt
ASKER CERTIFIED SOLUTION
mktgweb

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros