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)
DCR Parsing problems
vanesh
Hi All,
I have a problem with the DCR Parser.
At the moment I parse a DCR and I try to update another DCR with the values from the first one. The values are in 3 languages EN, FR, NL for some fields.
Although both DCRs are in UTF-8, it seems there is an encoding problem.
My feeling is that when it reads the value it converts it in ASCII or something.
look at the value of keywords_fr (mots-cléfs FR, salut --> mots-cléfs FR, salut).
Can anyone help on this.
Thanks & Regards,
Vanesh
Find more posts tagged with
Comments
gzevin
are you escaping all the fields
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
vanesh
Hello,
Here is the code I use :
#!/iwenv/iw-home/iw-perl/bin/iwperl
use TeamSite:
CRnode;
sub read_file {
my ($file_name) =
@_
;
local($/) = wantarray ? $/ : undef;
local(*F);
my $r;
my (
@r)
;
open(F, "<$file_name") || die "open $file_name for reading: $!\n";
@r
= <F>;
close(F) || warn "problem closing $file_name: $!\n";
return $r[0] unless wantarray;
return
@r
;
}
$dcr1 = "/default/main/prd/test/templatedata/test/dcr1";
$dcr2 = "/default/main/prd/test/templatedata/test/dcr2";
$dcr_string = read_file($dcr1);
$dcr_node = TeamSite:
CRnode->new($dcr_string);
my $keywords_fr = $dcr_node->value('Keywords_FR');
print "keywords_fr: $keywords_fr\n";
$dcr_string = read_file($dcr2);
$dcr_node = TeamSite:
CRnode->new($dcr_string);
$dcr_node->set_inner_xml('Keywords_FR', $keywords_fr);
my $modified_dcr = $dcr_node->get_dcr();
print "modified_dcr: $modified_dcr\n";
gzevin
most likely you'd need to escape the XML before you are setting it ...The Entities will come unescape on retrieval, so they need to be encoded back
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
Migrateduser
Are you sure ?
Only characters like <,>,",',& have to be escaped in XML.
To me this looks more like an encoding problem : the original value is encoded in UTF-8 and it's converted into text (ascii ?).
I guess it should be possible to specify the encoding somewhere or to encode the value to UTF-8 before updating the other DCR.
If someone find the solution to this problem, I'm also interested because we also use french :-)
gzevin
actually, this make makes me ask the original poster a question - perl 5.8 handles UTF-8 natively - so which version of TeamSite we are talking about?
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
kellyrmilligan
Hello, sounds like a similar problem I am having. I am basically doing this:
my $policy =$rootnode->get_inner_xml('CONTENT_POLICY');
#manipulate $policy variable
$rootnode->set_inner_xml('CONTENT_POLICY',$policy);
#write it to a file
but I have the ">" signs within the content, since it is HTML.
I have written the output of the policy variable after I have changed it, and it is ok until right after I do set inner xml method.
Teamsite 6.1, Solaris
Any ideas?
rodigz
hi all,
what's solution for this? I'm encountering the same problem.