3

Just noticed on our clients 2013 SP1 DD4T site that Arabic translated content is being rendered in the browser as HTML character references.

So when you view source, لماذا عليك is <title>&#1575;&#1604;&#1605;&#1608;&#1575;</title>.

Looking at other Arabic sites like www.emirates.com/ae/arabic/ the source shows the Arabic content un-encoded.

I checked in Fiddler and the encoding is part of the response sent back by the server, so I guess I need something on the ASP.NET side to prevent this from happening?

6

You'll have to verify the entire chain from CM source to client side interpretation to see where this conversion is happening; you've already verified that the HTML encoded characters are sent from the CD server so it's not a client side issue.

That leaves as potential culprits:
- your ASP.Net web application
- the Tridion broker libraries (assuming you use these)
- the Tridion deployer (or a custom deployer in case you have one)
- the Tridion transport mechanism
- the DD4T templates (or your own modified version of these if applicable)
- any event system or automatic workflow activities (if you have any of these)
- the CM WebGUI
- your editors

I'd start from the bottom of this list and verify that the content stored in Tridion doesn't actually contain the character references (but the real UTF-8 characters). If it's wrong here either an event system, the CM WebGUI or your editors are causing the issue.

If things look good here; check the broker database content (note that this is encoded in UTF-16 for component presentations in 2013 and higher; so try with the page content first maybe which should still be human readable). If it's wrong here either the DD4T templates or the transport service or the deployer are causing the issue.

If it is still good there the issue must be with either your ASP.Net web application of the broker libraries.

The most likely candidate would be the ASP.Net web application as any HttpServerUtility.HtmlEncode method call (or something similar) on the content can potentially cause this.

| improve this answer | |
  • 5
    OK - so it seems this is a Razor thing - Razor encodes string by default. So instead of doing @ViewBag.Title in our layouts - we had to use @Html.Raw(ViewBag.Title). Cant believe I'd never come across this before! – Neil Aug 24 '15 at 13:16
  • In addition - we where using the AntiXssEncoder globally as the application HTML encoder. It was this that was encoding our text as only Latin based languages are considered "safe" by AntiXssEncoder. – Neil Aug 24 '15 at 15:25
5

Hey Neil check out this encoding roadmap for Tridion, you're probably referring to point 6 in the article, but definitely good to re-check all points listed.

http://elenaserghie.blogspot.com/2012/01/7-clues-to-solve-character-encoding.html

| improve this answer | |
  • No joy I'm afraid Elena. Everything that can be UTF-8 is! – Neil Aug 24 '15 at 7:51
  • Also, this isnt an encoding "error" per say - the HTML characters refs are correct - I just don'y know why they're appearing. – Neil Aug 24 '15 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.