[TYPO3-dev] How to write Special Chars to DB?

Christian Tauscher Christian.Tauscher at kodiak.de
Mon Jun 26 13:37:47 CEST 2006


Hello my dear Developers!

I am stuck with this Problem on my latest Extention:

In BE editors create new records, and as usual, they use strange 
Characters like " and german Umlate (äöüß) and of corese more strange 
things like -> „ “ <- (lower quotation mark).

A look to the sql-DB shows that these Characters are inserted in the DB 
correctly. Even in the FE they are renderd perfecly.

My Problem now is, that I have to create a some E-Mail link out of this 
DB-Record with subject and Body filled with this content.

This is the code to generate this "Forward"-Feature:

$link  = '<a href="mailto:?Subject=';
$link .= rawurlencode($this->conf['mailSubject']);
$link .= '&Body=';
$link .= rawurlencode($this->getFieldContent('orders'));
$link .= '">';
$link .= "Forward";
$link .= "</a>";
return $link;

You click this link, the mailer opens, Subject and Body is filled, but: 
The body stumbles on these special characters. Beginning with the first 
special char only nonsens is in the mail.

If there are no special chars in the mail, everything works perfekt.

How do I treat the content correctly? are there functions like 
urlencode/htmlspecialchars etc. i should use to write the data to the DB 
and treat them again with the decode funcion für working with this data? 
Which pair is the common/best to use?

I have tried urencode/rawurencode/htmlspecialchars... with more or less 
succsess, but finally I faild.

It would be nice if someone could tell me more about the treatement of 
chars in this case.

Thanks a lot für aour patience and help,

Christian

P.S.: the website is NOT running in UTF-8 mode!




More information about the TYPO3-dev mailing list