Nevermind...

I made a mistake. I was actually parsing the string two times; therefore, the source string was not encoded as ISO-8859 anymore the second time.

It is working fine now...

Stefano

Stefano Noffke ha scritto:
Greetings,

I have a problem with iconv(), and I need help solving it.

Here is the background:

I have a Web page with a Form that saves data to a MySQL database. I need to retrieve the data from the database and create a PDF document with FPDF.

The Web Page, the database, and the browser are all set to UTF-8, so I have to convert the data from the database to ISO-8859-1 in order to have FPDF show it correctly. I am using iconv() to convert the data.

It works like a charm for the data acquired with text boxes, but it does not parse the data acquired from textareas correctly.

For example:

I have an text input (<input type="text" />) and a textarea (<textarea></textarea>). I type the string "sometextàèìòùésomeothertext" on both the input fields and save it into the database through POST.

If I retrieve the data and show it on a web page, it shows correctly. I then create the PDF with FPDF parsing the data with the following instructions:

iconv("UTF-8", "ISO-8859-1", $inputText)
iconv("UTF-8", "ISO-8859-1//TRANSLIT", $textarea) or iconv("UTF-8", "ISO-8859-1", $textarea)

The PDF shows the first record correctly, while the second only shows "sometext"

If I use
iconv("UTF-8", "ISO-8859-1//IGNORE", $textarea)
the PDF shows "sometextsomeothertext" skipping all the special chars.


Why is the textarea behaving differently than the text input? Is there a way to fix this?

I would really appreciate any help, thank you.

Stefano

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

Reply via email to