aboutsummaryrefslogtreecommitdiffstats
path: root/genhdlist2
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-03-05 11:02:14 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-03-05 11:02:14 +0000
commitebc32d5da492feb87c39004f5169c44f1db8f811 (patch)
treec777e7e2f0b6add7fa60a36c0c8a2b77f391977c /genhdlist2
parentdcacd730782642d4dc08c497b80ef9d6f7d8f041 (diff)
downloadrpmtools-ebc32d5da492feb87c39004f5169c44f1db8f811.tar
rpmtools-ebc32d5da492feb87c39004f5169c44f1db8f811.tar.gz
rpmtools-ebc32d5da492feb87c39004f5169c44f1db8f811.tar.bz2
rpmtools-ebc32d5da492feb87c39004f5169c44f1db8f811.tar.xz
rpmtools-ebc32d5da492feb87c39004f5169c44f1db8f811.zip
- genhdlist2:
o use utf8:: functions instead of Encode (to be able to work with only perl base modules)
Diffstat (limited to 'genhdlist2')
-rw-r--r--genhdlist217
1 files changed, 9 insertions, 8 deletions
diff --git a/genhdlist2 b/genhdlist2
index cc1a682..d42158d 100644
--- a/genhdlist2
+++ b/genhdlist2
@@ -5,7 +5,6 @@
use URPM;
use MDV::Packdrakeng;
use Getopt::Long;
-use Encode;
main();
@@ -237,14 +236,16 @@ sub close_xml {
}
sub ensure_utf8 {
- my ($s) = @_;
-
- Encode::_utf8_on($s); #- this is done on the copy
- if (!Encode::is_utf8($s, 1)) {
- Encode::_utf8_off($_[0]);
- Encode::from_to($_[0], 'iso-8859-15', 'utf8');
+ if (utf8::is_utf8($_[0])) {
+ utf8::valid($_[0]) and return;
+
+ utf8::encode($_[0]); #- disable utf8 flag
+ utf8::upgrade($_[0]);
+ } else {
+ utf8::decode($_[0]); #- try to set utf8 flag
+ utf8::valid($_[0]) and return;
+ warn "do not know what to with $_[0]\n";
}
- Encode::_utf8_on($_[0]); #- now we know it is valid utf8
}
sub encode_xml {