Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
modifying DCR from a perl script - special characters
maru
Hi,
I'm trying to modify a DCR using a perl script. My issue comes when i'm working with special characters (in this case Korean characters). I'm trying to update one field from a replicant and i'm only getting garbage characters.
I've got a global variable $pageTitle and i have tried several things that i've seen in some posts but it's still not working.
I have tried this:
1) $pageTitle = Encode::encode_utf8($pageTitleTemp);
2) $pageTitle = encode("utf8", $pageTitle);
3) $pageTitle = encode("iso-8859-1", decode("utf8", $pageTitle ));
4)
$def = "\n";
#Writing in the DCR
open (DCR, ">:encoding(UTF-8)", "$DCR_full_path");
binmode DCR, ":utf8";
print DCR $def;
print DCR $modDCR;
close DCR;
5) put this at the top of my script:
use open ':utf8';
binmode (STDOUT, ":utf8");
binmode (STDIN, ":utf8");
binmode (STDERR, ":utf8");
Is there something i'm missing or need to add to show these characters properly?
I'm working in TeamSite 6.7.1 SP1 in windows environment.
Thanks.
Find more posts tagged with
Comments
nipper
How are you determining that you are getting garbage ? Are you certain the browser you are working with has the Korean character set ? Have you applied the BOM to the output file ?
Andy
ErrorHeader.pdf
ValidPreview1inch.pdf
maru
Now i have verified that indeed i'm not getting 'garbage' characters because i opened my DCR (xml) using my browser and i could see the characters displaying properly even though i had to change my encoding set to korean because with utf-8 weren't showing properly.
The issue comes now when i open this DCR in teamsite... In my dcr i have 2 replicants, one i added through GUI and the second one i added in the backend (from my ipl), the second replicant is the one that is not showing properly when i'm opening the form in TeamSite (Edit). I changed my browser encoding to UTF-8 or Korean and the second replicant (the one modified from the backend) still appears with "strange" characters.
I'm attaching my xml.
Thanks.
vera
Maru, you probably solved this problem long ago, but in case not. We had a similar problem, which turned out to be two problems. First of all, when we queried from our Oracle DB with DBI, we were losing the international characters. We had to set NLS_NCHAR and NLS_LANG to utf-8 so the querying into Perl would work. Second of all, when we wrote the data to HTML in the Perl script, it was not UTF-8 and getting lost here also. So after printing out the and tags, you need to print out <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Hopefully if you still have this problem this will put you on the right track
-Vera
vera
Sorry the line you need isn't displaying I will attach
maru
Thanks vera for your response.
Yes, indeed we solved it time ago.. we had to do 2 things, since i was getting my PageTitle value from a DCR through form API i had to 'escape' my value when passing it as a parameter, something like this:
window.open("http://"+server+"/iw-bin/save_and_deploy.ipl?vpT="+escape(pageTitle));
and once i had it in my perl i had to decoded
$pageTitle = decode('utf8', $pageTitle);
With this i didn't lose any encoding and i was able to put my pageTitle value in another DCR replicant.
Thank you.