-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Package: libspreadsheet-writeexcel-perl
Version: 2.11-2
Severity: normal
Tags: patch, upstream

Hi, group,

Below is a patch, which enables using national non-ascii characters in
worksheet name in $wb->add_worksheet('name').

Currently WriteExcel supports non-ascii chatacters for add_worksheet,
but they have to be manually encoded in utf16-be and a special aprameter
is needed, i.e.

$wb->add_worksheet(Encode::encode('utf-16be', 'non-ascii'), 1);

After my patch, the above becomes:

$wb->add_worksheet('non-ascii')

which is the same as in ascii-only worksheet names. Ah, and the above
line should be in "use utf8" context, of course.


I've already reported the bug upstream. See https://rt.cpan.org/NoAuth/Bug.html?id=11700

The reasons I am writing here too are:

1) Someone may see something wrong with the patch, in which case I'd be
~  most happy to fix it.
2) Upstream may delay applying the patch, but I'd like to add non-ascii
support in add_worksheet asap, provided there are no objections here.


Ah, by the way, there is some missing "native" utf8 support in ParseExcel too, but I am still investigating. I'll provide bugreport/patch when I have a clearer idea of what's wrong.


Best regards, dam

- -- System Information:
Debian Release: 3.1
~  APT prefers unstable
~  APT policy: (500, 'unstable'), (500, 'testing'), (101, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.10+dam.1
Locale: LANG=bg_BG.UTF-8, LC_CTYPE=bg_BG.UTF-8 (charmap=UTF-8)

Versions of packages libspreadsheet-writeexcel-perl depends on:
ii  libparse-recdescent-perl      1.94-1     Generates recursive-descent
parser
ii  perl                          5.8.4-6    Larry Wall's Practical
Extraction

- -- no debconf information
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCJIdJHqjlqpcl9jsRApG3AJ4mcQ9sGK5nKYFNlm9GgyfxEbc7LgCfYwQJ
GSX+IkEf0tFqFQ37FlP8J7U=
=YcDI
-----END PGP SIGNATURE-----
--- /usr/share/perl5/Spreadsheet/WriteExcel/Workbook.pm 2005-01-25 
18:35:27.000000000 +0200
+++ /tmp/Workbook.pm    2005-03-01 16:31:05.759259615 +0200
@@ -332,6 +332,16 @@
     my $encoding = $_[1] || 0;
     my $limit    = $encoding ? 62 : 31;
 
+    # Support newer perls native unicode
+    if ($] >= 5.008) {
+        require Encode;
+
+        if (not $encoding and Encode::is_utf8($name)) {
+            $name = Encode::encode("UTF-16BE", $name);
+           $encoding = 1;
+           $limit = 62;
+        }
+    }
 
     # Check that sheetname is <= 31 (1 or 2 byte chars). Excel limit.
     croak "Sheetname $name must be <= 31 chars" if length $name > $limit;

Reply via email to