aboutsummaryrefslogtreecommitdiffstats
path: root/genhdlist2
diff options
context:
space:
mode:
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 {