Home
TeamSite
Spanish characters in XSLt
Nikunj
We cannot display spanish characters properly in an html
Our code generates a html of a dcr using xslt.
The xsl has the following tag
< P class="paragraph" >< xsl:value-of select="//body/introparagraph" disable-output-escaping="yes"/ > < /P >
Due to the disable output escaping tag,the formatting tags which are present in the dcr text areas using visual format (for eg < p > or etc) get reflected properly in the htmls.
However our Spanish xml has the following tag value
< segement > Pequeña empresa < /segment >
The character ‘ñ’ does not show up properly in the html.
If we remove the disable output escaping tag ,the html prints the character ‘ñ’
Properly however it then does not convert the visual formatted tags and prints them as it is.
We noticed that if our xml has this value
< segment >Pequeña empresa < /segment > instead of ‘ñ’ directly with the disable output escaping tag present our problem is resolved.
However we have ‘ñ’ in all our xmls which cannot be replaced by ‘ñ’
Is there a way where we could have both,the visual formatted tags converted to their rightful meaning in an html and also get the char ‘ñ’ printed.
Find more posts tagged with
Comments
yanSi
I thought the VFE automatically converts special characters into html entities.
Previously, I had to deal with French characters not in VFE fields and found that if the tpl (or in your case, the xsl) file was saved in UTF-8 format, then you won't have to convert the chars into entities. Make sure the xsl is SAVED, not DECLARED to have UTF-8 encoding.
Rick Poulin
Like yanSi said, saving it in UTF-8 should work. If it doesn't, you can try converting the characters to XML entities (not HTML entities). Eg. ñ becomes ñ
yanSi
Hey Nikunj, I'm curious to know how you're using XSLT to handle text manipulation. With regular TPLs, you can use iw_perl tags to do that sort of thing but I don't see how that functionality can be replaced in XSLT.
Have you also found a way to have the Preview button call a XSLT compiler directly or are you using perl in a TPL to call the XSLT compiler?
Frederik
some hints:
- does the produced HTML file declare its content encoding? should be set to UTF8 probably to avoid trouble
- are you using < iwov_xslt> tag in .tpl to do the conversion? We found this tag's code to be badly broken when jumping from 5.5.2 to 6.5 sp2. Support claims that it got fixed in 6.7 (maybe also in some 6.5 patch or sp) but I remain suspicious because the hotfix they send us was just as broken. We worked around it on our end.
good luck... encoding issues can be frustrating, I know full well.