c# - Encoding for international character -


i making google suggestion api

and requtesting "¿cómo estás" word should have return

¿cómo estás ¿cómo estás hoy ¿cómo estás meaning ¿cómo estás tú ¿cómo estás cuando nadas ¿cómo estás yo (1) ¿cómo estás yo ¿cómo estás response ¿cómo estás in english

but showing

[{"phrase":"como estás"},{"phrase":"cómo estás en inglés"},{"phrase":"como estás em espanhol"},{"phrase":"cómo estás lleva acento"},{"phrase":"cómo estás tú"},{"phrase":"cómo estás hola"},{"phrase":"como estas means"},{"phrase":"como estas reply"},{"phrase":"como estas usted"},{"phrase":"como estas hoy"}]

and response is

enter image description here

ignore keywords.

you can see

¿

is missing in result

my code

system.net.httpwebrequest request = webrequest.create(url) httpwebrequest; request.contenttype = "text/html; charset=utf-8"; using (system.net.httpwebresponse response = request.getresponse() httpwebresponse) {     streamreader reader = new streamreader(response.getresponsestream(), system.text.encoding.getencoding("iso-8859-2"));     result = reader.readtoend(); }  xdocument doc = xdocument.parse(result);  if (!referenceequals(doc.descendants("suggestion"), null) && doc.descendants("suggestion").count() > 0) {     var suggestions = suggestion in doc.descendants("completesuggestion") select new googlesuggestion { phrase = suggestion.element("suggestion").attribute("data").value };     allsuggestions = suggestions.tolist(); } 

please advise encoding should use...

just if help..

i solved using

 streamreader reader = new streamreader(response.getresponsestream(), system.text.encoding.getencoding("iso-8859-1")); 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -