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)
Editing DCR XML containing spl chars and chinese
AnandRIyer
Hello there,
I am trying to modify a DCR field value at the end of a background process. (Updating the status of the content within the content)
The DCR (using DCR::Node) which contains chinese/japanese content in textarea and text fields and also the special symbols/characters for, Regd. and Copyright is not recognized as valid xml.
I do not have any problems with only the Chinese/Japanese content. But when there are special symbols (©, ®) in the content, I encounter the error.
Could someone help me or suggest a workaround?
Iyer
Find more posts tagged with
Comments
Migrateduser
I've had problems with this, too. As you're parsing the XML, replace the symbols with their HTML equivalent (being careful to stay away from < and > characters, of course.
For instance, you could write
$value =~ s/©/©/g;
You MAY have to write "&copy;" instead of "©", I'm not sure right now.
Dave
Current Environment(s):
(1) TS 6.1 SP1 on W2K3
(2) TS 6.1 SP1 on W2K
AnandRIyer
Thanks Dave!
An additional complication now... I cannot limit the possibilities of the special characters to just © and ® ... there can be many others.
I'm looking at something in the lines of devnet Tech Article: 48832 (
http://devnet.interwoven.com/site.fcgi/techlib/048832
) but I do not want to lose the UTF-8 character set for the multi-lingual content either.
I've given thought to plain text file treatment of the DCR with regexes doing the job... but this is just the start. I will need to loop through replicants with multiple items within. Plus this is not a structured solution at all.
FYI, I'm working on TS 6.1 on Win2k. This is getting frustrating with time running out.
Cheers,
Iyer
Migrateduser
I had to deal with the same thing -- long list of possible special characters. I believe there's either a module for that or perhaps there's some code here on DevNet that takes care of that (I wouldn't be surprised if it were the latter).
How about when you slurp the file ($xml = $/), you do the substitution then. Before parsing the XML, etc.... then, you don't have to worry about the looping.
Dave
Current Environment(s):
(1) TS 6.1 SP1 on W2K3
(2) TS 6.1 SP1 on W2K
AnandRIyer
Hey ... Some hours of R &D later....
with
use Unicode::string qw(utf8);
# parse XML
# edit values
$filecontent = utf8($filecontent);
$filecontent = $filecontent->utf8;
# save as file using perl I/O
works!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
thanks for your support Dave!
Iyer