Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Encoding issue
prem_pratick
Hi,
I am having a Template the populates drop downs/select box using call server.
i.e.
Select 1 --> Country - We use inline callout for this.
Select 2 --> State - We use callserver for this. We pass the country name and get the corresponding state names.
So when a user changes Country, the state drop down will also change.
We are facing issue when we Select China. The State names are in Chinese.
- We pass the country name to a .ipl (using callserver).
- The .ipl uses a perl subroutine to get the list of state for the country and saves the same in an array. (StateOptions)
- We are using utf8::encode($label); to encode the same state name while adding it to the array.
- "StateOptions" is the array name that has the state names. We are unable to decode it when we are using parent.getScriptFrame();
Can any one help me on this.
Find more posts tagged with
Comments
Rick Poulin
Using utf8::encode($label) only works if your browser will properly interpret the response as UTF-8. You can help it along by changing your content-type header to include a charset:
print "Content-type: text/html; charset=utf-8\n\n";
If that still doesn't work, you may have to print the Javascript strings using unicode escapes, e.g. "北京" should be "\u5317\u4EAC". You can use a combination of a regex and the pack() function to convert your string to such a notation.
ISCBorisB
Removed - Rick already covered my content-type Header note
prem_pratick
Thanks for the help.
print "Content-type: text/html; charset=utf-8\n\n"; solved the issue.
along with the utf8::encode($label);
Now I am able to use the DCR in the component.
prem_pratick
Hi,
The Solution mentioned will just work for IE 6. Chinese will not work in IE7 and IE8.
So I added the below in CSS code:
select{font-family: Arial Unicode MS, Arial, Helvetica, sans-serif !important;}
Ui Customisation CSS file:-
/iw-home/ts-home/local/config/lib/content_center/customer_src/web/formspub/styles/custom.css
The CSS code was added in the above custom CSS.
Below command to be executed to rebuild the ui:
$bash> cd /iw-home/ts-home/local/config/lib/content_center/customer_src
$bash> /iw-home/ts-home/iw-perl/bin/iwperl /iw-home/ts-home/bin/make_toolkit.ipl
The drop downs in IE7 and IE8 now support all types of languages.
Thanks,
Prem Kumar