Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer
| From: | Ashley Sheridan | Date: | Tue, 13 Jan 2009 14:49:05 +0000 |
| Subject: | Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-286211@lists.php.net to get a copy of this message | ||
On Tue, 2009-01-13 at 16:33 +0200, Thodoris wrote:
> > On Tue, 2009-01-13 at 16:07 +0200, Thodoris wrote:
> >
> >>> On Tue, 2009-01-13 at 15:51 +0200, Thodoris wrote:
> >>>
> >>>
> >>>> Hi gang,
> >>>> I am generating a spreadsheet using the contents of a mysql table. I
> >>>> guess that there is something in the data that causes iconv used in the
> >>>> module's script to generate this error:
> >>>>
> >>>> *Notice*: iconv() [function.iconv
> >>>>
> >>>> <file:///C:/Documents%20and%20Settings/tgol/Local%20Settings/Temp/function.iconv>]:
> >>>> Detected an incomplete multibyte character in input string in
> >>>> */usr/local/share/pear/Spreadsheet/Excel/Writer/Worksheet.php* on line
> >>>> *1547*
> >>>>
> >>>> This causes the production of weird characters in a cell in the
> >>>> spreadsheet and after that cell everything is printed out of order.
> >>>>
> >>>> The data in the mysql table are filtered for non-printable character
> >>>> before the data import.
> >>>>
> >>>> I have tried to filter the data before writing them into the sheet but
> >>>> this behavior persists.
> >>>>
> >>>> Any ideas in what might be wrong?
> >>>>
> >>>>
> >>>>
> >>> Well a multibyte character is something like a character from utf-8 or
> >>> unicode, where more than one byte is used to represent the character.
> >>> Does the Excel writer you use support utf or unicode?
> >>>
> >>>
> >>> Ash
> >>> www.ashleysheridan.co.uk
> >>>
> >>>
> >>>
> >> Actually it does and AFAIK it changes everything into UTF-16LE. The
> >> Excel writer is the pecl module Spreadsheet_Excel_Writer.
> >>
> >> BTW do you have any suggestions for a better open source writer I could use?
> >>
> >> --
> >> Thodoris
> >>
> >>
> >>
> > Unfortunately I don't know of any other Excel writers, but I never
> > really use that format anymore if I can help it. Would a CSV not work?
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
>
> Well it does work but unfortunately both need to be supported.
>
> I should say that it actually is the pear module
> Spreadsheet_Excel_Writer and not pecl.
>
> I could probably try to debug the module itself but this is usually a
> very bad idea. I came to this point because I have stripped all
> non-printable characters, tabs, CRs and LFs before writing into the
> speadsheet but nothing seems to work.
>
Is there any chance its characters creeping in from being copied from a
M$ program? I found that M$ software uses it's own character encodings
for multibyte characters which causes no end of problems for web-based
systems. A lot of it was where angled quotation marks were added my
Word, and not encoded using the UTF encodings, but the M$-style ones
instead.
Ash
www.ashleysheridan.co.uk