Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer

2009-01-16 Thread Ewen Cumming
Good question, according to the author 'There was only a little problem with
_calculateSharedStringsSizes() and _storeSharedStringsTable() functions
within the Workbook.php. They did not support unicode strings.'

Ewen


2009/1/15 Thodoris t...@kinetix.gr


  Hi there, I'm not sure if this is the same problem but after I struggled
 with strange characters in Spreadsheet Excel Writer for some time I wrote an
 article from my lessons learned:
 http://research.elabs.govt.nz/generating-excel-spreadsheets-with-maori-macrons-in-php/

 It contains some example code, hope it helps.

 Ewen


 2009/1/14 c...@l-i-e.com c...@l-i-e.com

The charset: latin1 and the collation: latin1_swedish_ci.


  Trivia quiz at a MySQL presentation at my Chicago PHP User Group a few year
 ago comes in handy!

 The defaults for MySQL are actually latin1_swedish as that is the native
 language of the original developer, (?Monty Widenus?)

 This charset differs in only one character (or two chars switched?) from
 English.

 It seems unlikely to produce drastic problems in iconv, but I have no idea
 what I'm actually talking about.

 We now return you to your regularly scheduled program!


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 Thanks man that did it :-) .
 What exactly was the problem you've noticed (I am seeing a diff between the
 two files bu t I am not sure I fully understand)?

 --
 Thodoris




Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer

2009-01-15 Thread Ewen Cumming
Hi there, I'm not sure if this is the same problem but after I struggled
with strange characters in Spreadsheet Excel Writer for some time I wrote an
article from my lessons learned:

http://research.elabs.govt.nz/generating-excel-spreadsheets-with-maori-macrons-in-php/

It contains some example code, hope it helps.

Ewen


2009/1/14 c...@l-i-e.com


  The charset: latin1 and the collation: latin1_swedish_ci.

 Trivia quiz at a MySQL presentation at my Chicago PHP User Group a few year
 ago comes in handy!

 The defaults for MySQL are actually latin1_swedish as that is the native
 language of the original developer, (?Monty Widenus?)

 This charset differs in only one character (or two chars switched?) from
 English.

 It seems unlikely to produce drastic problems in iconv, but I have no idea
 what I'm actually talking about.

 We now return you to your regularly scheduled program!


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer

2009-01-15 Thread Thodoris



On Wed, 14 Jan 2009 13:19:31 +0200, Thodoris wrote:

  

Variable_name   Value
character_set_clientutf8
character_set_connectionutf8
character_set_database  latin1
character_set_filesystembinary
character_set_results   utf8
character_set_serverlatin1
character_set_systemutf8



What's the character set of the column you get the data from?
  

The charset: latin1 and the collation: latin1_swedish_ci.



I'm not sure exactly how these affect the data
returned to PHP. The 'connection' and 'results'
variables would suggest utf8. In any case, it
must be one of 'latin1' or 'utf8'.

What happens if you do:

  $worksheet-setInputEncoding('latin1');
  /* or 'ISO-8859-1' */


It would still be helpful to see a hexdump.


/Nisse

  


Since the data are in greek I can't see anything but despite that the 
xls still breaks. In addition to that MS-Excel doesn't even open the 
file because it thinks it is corrupted. OOffice still opens it as before 
but it breaks in a certain line.


BTW As you have already guessed I am using:

$worksheet-setInputEncoding('UTF-8');

I think that it is the pear extension's problem and has something to do 
with the encoding. I  hex dumped  the data and no curious characters 
seem to be there. Moreover the line in the xls that the script breaks 
the data written changes if I change the encoding.


--
Thodoris



Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer

2009-01-15 Thread Thodoris



Hi there, I'm not sure if this is the same problem but after I struggled
with strange characters in Spreadsheet Excel Writer for some time I wrote an
article from my lessons learned:

http://research.elabs.govt.nz/generating-excel-spreadsheets-with-maori-macrons-in-php/

It contains some example code, hope it helps.

Ewen


2009/1/14 c...@l-i-e.com

  

The charset: latin1 and the collation: latin1_swedish_ci.
  

Trivia quiz at a MySQL presentation at my Chicago PHP User Group a few year
ago comes in handy!

The defaults for MySQL are actually latin1_swedish as that is the native
language of the original developer, (?Monty Widenus?)

This charset differs in only one character (or two chars switched?) from
English.

It seems unlikely to produce drastic problems in iconv, but I have no idea
what I'm actually talking about.

We now return you to your regularly scheduled program!


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





  


Thanks man that did it :-) .
What exactly was the problem you've noticed (I am seeing a diff between 
the two files bu t I am not sure I fully understand)?


--
Thodoris



Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer

2009-01-15 Thread VamVan
Thanks man that did it :-) .
What exactly was the problem you've noticed (I am seeing a diff between the
two files bu t I am not sure I fully understand)?

-- 
Thodoris


Yes I have previously worked on loads of Greek sites. Some how strange
enough I had problems whenever I used UTF-8 to store content and even
display on the web page.

So I had to use default latin swedish ci in the db and also use Charset 1253
in the html meta tag to get everything displayed properly.

meta http-equiv='Content-Type' content='text/html; charset=windows-1253'

Thanks,
V


Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer

2009-01-14 Thread Thodoris



On Tue, 13 Jan 2009 15:51:01 +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.



What data goes into that cell?
  


I am selecting from a mysql table where only text and numeric data exist.


Can you provide a hex dump of the data?
  


I am no sure how to do that in that case :-( .


How do you filter the data?
  


The data are being filtered by stripping all the non-printable 
characters and by form validation using regxp.



How do you write it to the worksheet?
  


Using the pear extension Spreadsheet_Excel_Wrtiter.


What character encoding did you set?
  


UTF-8



/Nisse

  


--
Thodoris



Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer

2009-01-14 Thread Nisse Engström
On Wed, 14 Jan 2009 11:33:25 +0200, Thodoris wrote:

 On Tue, 13 Jan 2009 15:51:01 +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.
 

 What data goes into that cell?
   
 
 I am selecting from a mysql table where only text and numeric data exist.
 
 Can you provide a hex dump of the data?
   
 
 I am no sure how to do that in that case :-( .
 

?php echo bin2hex ($theData), \n; ?

What's the output of:

  SHOW VARIABLES LIKE 'character_set%'

What's the character set of the column you get the data from?


/Nisse

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer

2009-01-14 Thread Thodoris





?php echo bin2hex ($theData), \n; ?

What's the output of:

  SHOW VARIABLES LIKE 'character_set%'
  


Variable_name   Value
character_set_clientutf8
character_set_connectionutf8
character_set_database  latin1
character_set_filesystembinary
character_set_results   utf8
character_set_serverlatin1
character_set_systemutf8




What's the character set of the column you get the data from?
  


The charset: latin1 and the collation: latin1_swedish_ci.


/Nisse

  


--
Thodoris



Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer

2009-01-14 Thread Nisse Engström
On Wed, 14 Jan 2009 13:19:31 +0200, Thodoris wrote:

 Variable_name Value
 character_set_client  utf8
 character_set_connection  utf8
 character_set_databaselatin1
 character_set_filesystem  binary
 character_set_results utf8
 character_set_server  latin1
 character_set_system  utf8
 
 What's the character set of the column you get the data from?
 
 The charset: latin1 and the collation: latin1_swedish_ci.

I'm not sure exactly how these affect the data
returned to PHP. The 'connection' and 'results'
variables would suggest utf8. In any case, it
must be one of 'latin1' or 'utf8'.

What happens if you do:

  $worksheet-setInputEncoding('latin1');
  /* or 'ISO-8859-1' */


It would still be helpful to see a hexdump.


/Nisse

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer

2009-01-14 Thread ceo

 The charset: latin1 and the collation: latin1_swedish_ci.



Trivia quiz at a MySQL presentation at my Chicago PHP User Group a few year ago 
comes in handy!



The defaults for MySQL are actually latin1_swedish as that is the native 
language of the original developer, (?Monty Widenus?)



This charset differs in only one character (or two chars switched?) from 
English.



It seems unlikely to produce drastic problems in iconv, but I have no idea what 
I'm actually talking about.



We now return you to your regularly scheduled program!



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer

2009-01-13 Thread Nisse Engström
On Tue, 13 Jan 2009 15:51:01 +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.

What data goes into that cell?
Can you provide a hex dump of the data?
How do you filter the data?
How do you write it to the worksheet?
What character encoding did you set?


/Nisse

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php