Using Teamsite 6.1 on Solaris 8.
I'm looking for a global setting for iwperl that can make a plain-vanilla filehandle, like this:
open WRITE, ">" . $vpath;
Always behave like a utf8-aware filehandle, like this:
open WRITE, ">:utf8" , $vpath;
We are currently testing an upgrade of Interwoven from 5.5.2 to 6.X (Currently testing with 6.1 but plan to eventually use 6.5 sp2).
The problem: the following perl code (which worked fine on TS 5.5.2 w/perl 5.005_03) reads from a UTF-8 encoded dcr and then overwrites the DCR with the modified XML. But the re-written XML is no longer well-formed due to utf-8 character issues.
open READ, $vpath;
my $xmlString = join("",);
close READ;
my $rootNode = TeamSite:
CRnode->new($xmlString);
#some operations using the DCRnode...
$saveXML = $rootNode->get_dcr();
open WRITE, ">" . $vpath;
print WRITE $saveXML;
close WRITE;
The outcome appears to be that 'char-centric' utf8 is being written back to the file rather than 'byte-centric' utf8 (please see
https://support.interwoven.com/kb/kb_show_article2.asp?ArticleID=51304 for more on this). Afterward, the xml can no longer be parsed.
The following change corrects the encoding issue:
open WRITE, ">:utf8" , $vpath;
print WRITE $saveXML;
close WRITE;
But we would rather find a global solution to the problem as opposed to making changes to every open statement in our code (dozens, probably 100+ instances would require updates).
We have attempted to set the environmental variable 'PERL_UNICODE' with the value 'SDA' but the results seem to be inconsistent at best.
Can anyone recommend some type of global solution to the problem?