Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JuanDG - 18 Feb 2005 16:33 GMT
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

Signature

Juan David Gomez A.
Microsoft Certified Professional
Analista de Desarrollo - PSL S.A.
Web and Wireless Banking
Medellín - Colombia

Keenan Newton - 18 Feb 2005 20:52 GMT
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");
JuanDG - 21 Feb 2005 17:21 GMT
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

> 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");
Keenan Newton - 21 Feb 2005 19:47 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.