Monday, March 5, 2012

Browser is failing to render Japanese characters in WCF Data Service response.


Alternative Title 
  1. How to enable Unicode in WCF data service running on Devart(Dot Connect for Oracle) entity framework provider 
  2. How to enable Unicode in Devart (Dot Connect for Oracle -entity framework provider ) connection string.
Problem 
I was building a data services that was supposed to display  records stored in multiple languages including Japanese.
After building the services when I am rendering it in browser (IE/Mozila/FF) but it renders some junk characters for Japanese values but English is fine, Bellow is the sample
      <m:properties>
        <d:CountryCode>JP</d:CountryCode>
        <d:CustomerID>JP-XX</d:CustomerID>
        <d:FullName>¿¿ ¿¿</d:FullName>
      </m:properties>


Root Cause 
Actually I was using “Dot Connect for Oracle” data driver to connection oracle that uses default settingUnicode=False  http://www.devart.com/dotconnect/universal/docs/UseOraDirect.html  .  I am surprise why, Even though it is industry standard?
Solution 
We need to apply Unicode=true attribute in collection string defined in web.config , it works perfectly fine
<add name="MyEntities" connectionString="…………provider=Devart.Data.Oracle;provider connection string=&quot;User Id=***;Password=***;Unicode=true;Server=***;Direct=True;Sid=***;Port=***;Persist Security Info=True&quot;" providerName="System.Data.EntityClient" /> 

Please refer to my original post for more details 

No comments:

Post a Comment