Anil Namde
Anil Namde

Reputation: 6618

How to override content-type of YUI Connection Manager headers

I am using the YUI 2.7 Ajax (Connection Manager) api and would like to know how to override the content type of the connection manager especially character set.

The problem is that when registered trademark character (R) (Alt+0174) is sent to server using Ajax request its getting converted into Unicode and showing "?" on server side. As our system does not support Unicode db all such characters appear as "?" in the system. After initial analysis we have found that character set is set to UTF-8 for the content type ajax request header. So thought that it might be the issue. On server side we are using ASP.NET

Any pointers would be helpful.

Upvotes: 0

Views: 625

Answers (2)

Guillaume Filion
Guillaume Filion

Reputation: 510

Just put this in your code and all your ajax transactions will have this custom header:

YAHOO.util.Connect.initHeader('Content-Type', 'application/json; charset=utf-8', true);

Upvotes: 1

Tivac
Tivac

Reputation: 2573

Take a look at the example shown on the page for Request Signatures, it shows setting a custom header. Overriding default headers should work the same way.

Upvotes: 0

Related Questions