Author: mvidner Date: Tue Aug 11 16:17:11 2009 New Revision: 58322 URL: http://svn.opensuse.org/viewcvs/yast?rev=58322&view=rev Log: ycp.pm: convert wide strings to byte strings, to silence a warning when handling parsed XML (bnc#512536). Modified: trunk/core/VERSION trunk/core/agents-perl/lib/ycp.pm trunk/core/agents-perl/lib/ycp.test trunk/core/package/yast2-core.changes Modified: trunk/core/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/VERSION?rev=58322&r1=58321&r2=58322&view=diff ============================================================================== --- trunk/core/VERSION (original) +++ trunk/core/VERSION Tue Aug 11 16:17:11 2009 @@ -1 +1 @@ -2.18.17 +2.18.18 Modified: trunk/core/agents-perl/lib/ycp.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agents-perl/lib/ycp.pm?rev=58322&r1=58321&r2=58322&view=diff ============================================================================== --- trunk/core/agents-perl/lib/ycp.pm (original) +++ trunk/core/agents-perl/lib/ycp.pm Tue Aug 11 16:17:11 2009 @@ -715,6 +715,13 @@ sub WriteYcpString ($) { my $string = shift; + # We deal with binary strings (binmode raw), and most code is fine with it. + # But XML parsers will mark the strings as text, so convert them back. + # bnc#512536, thanks mls + # (Note that binmode STDOUT, :utf8 without the same for STDIN would + # make bnc#448217). + utf8::encode($string) if utf8::is_utf8($string); + my @substrings = split /\\/, $string, -1; foreach my $substring (@substrings) { Modified: trunk/core/agents-perl/lib/ycp.test URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agents-perl/lib/ycp.test?rev=58322&r1=58321&r2=58322&view=diff ============================================================================== --- trunk/core/agents-perl/lib/ycp.test (original) +++ trunk/core/agents-perl/lib/ycp.test Tue Aug 11 16:17:11 2009 @@ -349,6 +349,12 @@ } } +my $wide_string; +{ + use utf8; # this block contains UTF-8, man perlunicode + $wide_string = "TUÄÅÃK"; +} + my @output_string = ( [ "", '""' ], @@ -357,17 +363,23 @@ [ "tab\there", '"tab\011here"' ], [ "a backslash \\ and two \" quotes \".", '"a backslash \\\\ and two \\" quotes \\"."' ], [ "a trailing backslash\\", '"a trailing backslash\\\\"' ], + [ "tuÄÅák", '"tuÄÅák"'], # byte string + [ $wide_string, '"TUÄÅÃK"'], # text string (wide) should come out as bytes ); sub TestOutput () { print "TestOutput\n"; + open NULL, ">", "/dev/null"; for my $case (@output_string) { my $output = $case->[1]; print "\t'$output': " if $verbose; - Result ($output eq ycp::WriteYcpString ($case->[0])); + my $actual = ycp::WriteYcpString ($case->[0]); + # this triggers a warning if we print a wide character (bnc#512536) + print NULL $actual; + Result ($output eq $actual); } for my $case (@byteblock_test_out) { Modified: trunk/core/package/yast2-core.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/package/yast2-core.changes?rev=58322&r1=58321&r2=58322&view=diff ============================================================================== --- trunk/core/package/yast2-core.changes (original) +++ trunk/core/package/yast2-core.changes Tue Aug 11 16:17:11 2009 @@ -1,7 +1,10 @@ ------------------------------------------------------------------- -Tue Aug 11 13:10:57 CEST 2009 - mvidner@suse.cz +Tue Aug 11 16:16:29 CEST 2009 - mvidner@suse.cz +- ycp.pm: convert wide strings to byte strings, + to silence a warning when handling parsed XML (bnc#512536). - /var/log/YaST2/signal: do not make it executable +- 2.18.18 ------------------------------------------------------------------- Mon Aug 3 10:04:21 CEST 2009 - lslezak@suse.cz -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org