r1936 - in packages/libunicode-map-perl/trunk: debian t

Niko Tyni ntyni-guest at costa.debian.org
Sun Jan 15 20:47:33 UTC 2006


Author: ntyni-guest
Date: 2006-01-15 20:47:33 +0000 (Sun, 15 Jan 2006)
New Revision: 1936

Added:
   packages/libunicode-map-perl/trunk/debian/fix-big5
Modified:
   packages/libunicode-map-perl/trunk/debian/changelog
   packages/libunicode-map-perl/trunk/debian/rules
   packages/libunicode-map-perl/trunk/t/map.t
Log:
Fix 320406: Unicode::MapUTF8 does not handle one byte BIG5 characters properly


Modified: packages/libunicode-map-perl/trunk/debian/changelog
===================================================================
--- packages/libunicode-map-perl/trunk/debian/changelog	2006-01-15 20:45:49 UTC (rev 1935)
+++ packages/libunicode-map-perl/trunk/debian/changelog	2006-01-15 20:47:33 UTC (rev 1936)
@@ -1,8 +1,11 @@
 libunicode-map-perl (0.112-9) unstable; urgency=low
 
   * Add debian/watch.
+  * Fix the BIG5 map at build-time to include US-ASCII compatible
+    characters 0-127. (Closes: #320406)
+  * Test the fixed BIG5 map in t/map.t.
 
- -- Niko Tyni <ntyni at iki.fi>  Sun, 15 Jan 2006 22:43:12 +0200
+ -- Niko Tyni <ntyni at iki.fi>  Sun, 15 Jan 2006 22:46:48 +0200
 
 libunicode-map-perl (0.112-8) unstable; urgency=low
 

Added: packages/libunicode-map-perl/trunk/debian/fix-big5
===================================================================
--- packages/libunicode-map-perl/trunk/debian/fix-big5	2006-01-15 20:45:49 UTC (rev 1935)
+++ packages/libunicode-map-perl/trunk/debian/fix-big5	2006-01-15 20:47:33 UTC (rev 1936)
@@ -0,0 +1,33 @@
+#!/bin/sh
+# Insert the US-ASCII compatible characters into the BIG5 binary map,
+# since the original source file (currently  
+#  ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT
+# ) doesn't include them. Note that this depends on the binary map format.
+# Hopefully by the time it is changed, this problem has been fixed upstream.
+#
+# See http://bugs.debian.org/320406
+#
+# Copyright Niko Tyni <ntyni at iki.fi> 2005
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of either:
+# 
+# a) the GNU General Public License as published by the Free Software
+#    Foundation; either version 1, or (at your option) any later
+#    version, or
+# 
+# b) the "Artistic License" which comes with Perl.
+
+set -e
+
+IN=Map/EASTASIA/BIG5.map
+DD=/bin/dd
+PF=/usr/bin/printf
+
+$DD if=$IN bs=1 count=12 # header, 12 bytes
+$PF "\x0\x8\x0"          # partial key-value mappings
+$PF "\x8\x1\x10\x1"      # input 1 char of 8-bits at a time, output 1 char of 16 bits
+$PF "\x80\x0\x80\x0\x0"  # 128 characters starting at 0x00 -> 128 chars starting at 0x0000
+$PF "\x0\x0\x0"          # end of submap
+$DD if=$IN bs=1 skip=12  # rest of the file
+

Modified: packages/libunicode-map-perl/trunk/debian/rules
===================================================================
--- packages/libunicode-map-perl/trunk/debian/rules	2006-01-15 20:45:49 UTC (rev 1935)
+++ packages/libunicode-map-perl/trunk/debian/rules	2006-01-15 20:47:33 UTC (rev 1936)
@@ -18,10 +18,11 @@
 		dh_testroot
 		[ ! -f Makefile ] || $(MAKE) realclean
 		dh_clean
-		rm -f build-stamp install-stamp
+		[ ! -f fix-big5-stamp ] || mv debian/BIG5.map.dist Map/EASTASIA/BIG5.map
+		rm -f build-stamp install-stamp fix-big5-stamp
 
 build:		build-stamp
-build-stamp:
+build-stamp:	fix-big5
 		dh_testdir
 		perl Makefile.PL INSTALLDIRS=vendor
 		$(MAKE) OPTIMIZE="-O2 -g -Wall"
@@ -37,6 +38,15 @@
 		$(MAKE) install PREFIX=$(PWD)/$(TMP_DIR)/usr
 		touch install-stamp
 
+# fix the BIG5 map on the fly
+fix-big5:	fix-big5-stamp
+fix-big5-stamp:
+		dh_testdir
+		debian/fix-big5 > debian/BIG5.map.new
+		mv Map/EASTASIA/BIG5.map debian/BIG5.map.dist
+		mv debian/BIG5.map.new Map/EASTASIA/BIG5.map
+		touch fix-big5-stamp
+
 binary-indep:
 
 binary-arch:	build install
@@ -58,6 +68,6 @@
 
 binary:		binary-indep binary-arch
 
-.PHONY:		clean build install binary-indep binary-arch binary
+.PHONY:		clean build install binary-indep binary-arch binary fix-big5
 
 ## ----------------------------------------------------------------------

Modified: packages/libunicode-map-perl/trunk/t/map.t
===================================================================
--- packages/libunicode-map-perl/trunk/t/map.t	2006-01-15 20:45:49 UTC (rev 1935)
+++ packages/libunicode-map-perl/trunk/t/map.t	2006-01-15 20:47:33 UTC (rev 1936)
@@ -6,7 +6,7 @@
 # Change 1..1 below to 1..last_test_to_print .
 # (It may become useful if the test is moved to ./t subdirectory.)
 
-BEGIN { $| = 1; print "1..5\n"; }
+BEGIN { $| = 1; print "1..6\n"; }
 END {print "not ok 1\n" unless $loaded;}
 use Unicode::Map;
 $loaded = 1;
@@ -27,6 +27,7 @@
    ["GB2312",         "n->m: GB2312 (GB2312-80^8080 + ISO8859-1)"],
    ["DEVANAGA",       "n->m: DEVANAGA"],
    ["EUC_JP",         "n->m: EUC-JP"],
+   ["BIG5",           "n->m: BIG5"],
 );
 
 {
@@ -133,6 +134,21 @@
    return testMapping ( "APPLE-DEVANAGA", $_locale, $_unicode );
 }
 
+sub BIG5 {
+   my $_locale  =
+      "\xA5\x40"
+      ."\xA5\x41"
+      ."\x30"
+      ."  "
+   ;
+   my $_unicode =
+      "\x4E\x16"
+      ."\x4E\x15"
+      ."\x00\x30\x00\x20\x00\x20"
+   ;
+   return testMapping ( "BIG5", $_locale, $_unicode );
+}
+
 sub testMapping {
     my ( $charsetId, $txtLocale, $txtUnicode ) = @_;
     return 0 if ! ( my $Map = new Unicode::Map($charsetId) );




More information about the Pkg-perl-cvs-commits mailing list