473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

change encoding from UTF-8 to ISO-8859-1

Hi,

I have a .Net Web Service and the encoding of the SOAP Messages is always
UTF-8, and I need to change the web service so that it encodes with
ISO-8859-1 because it’s the only encoding my web services client supports.

I've updated my web.config & machine.config Globalization requestEncoding
and requestResponse settings to reflect this but whenever I test this
Through the default asmx page the XML header always includes the UTF-8
property, similarly when we test it using one of the web service clients it
also returns UTF-8 encoded SOAP Messages.

Is there anybody out there that can please help me with this????????

Thanks in advance,

Cheers

--

Juan David Gomez A.
Microsoft Certified Professional
Analista de Desarrollo - PSL S.A.
Web and Wireless Banking
MedellĂ*n - Colombia
Nov 23 '05 #1
3 11959
Add this in your constructor of your web service class. I beleive that
should work.

this.Context.Response.ContentEncoding =
System.Text.Encoding.GetEncoding("ISO-8859-1");

Nov 23 '05 #2
Thanks for the reply

I tried the line on my service and it says that 'this' does not contain a
definition for 'Context', so I created a new service in VWD 2005 and now I
can use your line in the constructor, but the service keeps responding UTF-8
encoded messages.

What am I doing worng??, can you help me a little more?????

Thanks

"Keenan Newton" wrote:
Add this in your constructor of your web service class. I beleive that
should work.

this.Context.Response.ContentEncoding =
System.Text.Encoding.GetEncoding("ISO-8859-1");

Nov 23 '05 #3
Are you sure you put it in the constructor of the Web Service class.
Context is definelty part of the WebService class see the MSDN
documentation.

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kiran | last post by:
Hi All, I have a xml file with UTF-8 encoding it has some chineese data values also. I wanted to change it to other encodings like UTF-16 ,GBK etc. I used iconv utility in Unix for this ..but was...
43
by: Vladimir | last post by:
Method UnicodeEncoding.GetMaxByteCount(charCount) returns charCount * 2. Method UTF8Encoding.GetMaxByteCount(charCount) returns charCount * 4. But why that? Look: /* Each Unicode character...
2
by: xmlguy | last post by:
This is part of the application that reads XML from file (that has UTF-8) into an XmlTextReader XmlTextReader myXmlReader = new XmlTextReader(args); It then instantiates an object/class...
4
by: Mark | last post by:
Hi... Just noticed something odd... In old ASP if you had query parameters that were invalid for their encoding (broken utf-8, say), ASP would give you back chars representing the 8-bit byte...
1
by: Alexander Cohen | last post by:
How would i go about changing a databases encoding? Is this at all possible? There does not seem to be much i can with ALTER DATABASE except change its name! -- Alexander Cohen...
0
by: Brad Wood | last post by:
I have a web service that returns an xml doc as a string. I use a StringWriter with my XmlTextWriter and the encoding attribute for the document becomes utf-16. If I save the result of the web...
2
by: John | last post by:
I am updating an xml column in SQLServer 2005, but it always gives me an error "XML parsing: line 1, character 38, unable to switch the encoding" my csharp is like the following ...
3
by: mortb | last post by:
1. How do I determine which encoding a xmldocument or xmlreader uses when opening a document? I'm not just talking about the <?xml encoding="utf-8"?attribute, but the actual encoding of the...
23
by: Allan Ebdrup | last post by:
I hava an ajax web application where i hvae problems with UTF-8 encoding oc chineese chars. My Ajax webapplication runs in a HTML page that is UTF-8 Encoded. I copy and paste some chineese chars...
14
by: Zoro | last post by:
My task is to read html files from disk and save them onto SQL Server database field. I have created an nvarchar(max) field to hold them. The problem is that some characters, particularly html...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.