Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^2: Strange behaviour (Spreadsheet::WriteExcell)

by hawtin (Prior)
on Feb 28, 2005 at 11:36 UTC ( #435023=note: print w/replies, xml ) Need Help??

in reply to Re: Strange behaviour (Spreadsheet::WriteExcell)
in thread Strange behaviour (Spreadsheet::WriteExcell)

Unfortunately the script is too big (and commercially sensitive) to easily produce a publishable version. As you can see from my comments I don't have enough of an understanding of the problem to be able to submit a bug report that would be of much help.

The data being output did originate in an XML file, and the script is running here under 5.6, so your second suggestion looks like a good candidate. As I said I suspect some kind of utf8 type issue but I cannot see anything that looks wrong.

Anyway I have found a fix, in my original code just before the write_string() I have inserted:

if(length($val) > 100) { # For some reason we have to duplicate # the contents of the string via a process # that detaches from the original variable # if the string is longer than 136 characters # (I don't know why) my $t = pack("c".length($val), unpack("c".length($val),$val)); $val = $t; }

Now it all seems to work :-O

Replies are listed 'Best First'.
Re^3: Strange behaviour (Spreadsheet::WriteExcell)
by jmcnamara (Monsignor) on Feb 28, 2005 at 11:49 UTC

    Yes, if that code fixes the problem then it is definitely a UTF8 issue. The Spreadsheet::WriteExcel docs also suggest the following workaround in the section Working with XML:
    $new_str = pack 'C*', unpack 'U*', $utf8_str;


Re^3: Strange behaviour (Spreadsheet::WriteExcell)
by Crian (Deacon) on Feb 28, 2005 at 12:58 UTC

    > the script is running here under 5.6

    Perhaps you could update to a modern version of Perl? There are many many utf8 bugs and problems fixed in the meantime.

      In this case it is running under 5.6 on Windows, elsewhere it is under 5.8 on Solaris. For various reasons I can't upgrade the Windows installation.

      Mind you for me 5.6 is a modern version, I have some customers that are still running Perl 4 scripts I wrote in 1993 :-(

        Can you use PAR or ActiveState's PDK to create '.exe' versions of your scripts such that all the Perl necessary for running your code is packed into that one '.exe' file, and thus the version of Perl for your program could independently be 5.8?

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://435023]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2023-02-03 00:19 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (24 votes). Check out past polls.