[drupal-devel] Email filter

Steven Wittens steven at acko.net
Fri Mar 18 07:14:29 UTC 2005

> Another question. How should we handle a situation where a user has 
> not compiled their php with iconv support? I made this mistake 
> initially, and as a result drupal_convert_to_utf8() returned empty 
> strings. drupal_convert_to_utf8() checks for the availability of 
> several libraries, and returns nothing if none are available. I wonder 
> if drupal_convert_to_utf8() shouldn't be patched to return the 
> original string if no conversion library exists?

Returning the original string means that garbage text is returned, or 
worse, that the new text is no longer valid UTF-8 (which breaks strict 
XML parsing for example). The correct behaviour is to not import data at 
all, as mixed encodings in one database (without a way to distiguish 
them) is very, very undesirable.

For installs that don't have iconv, the admin will get a watchdog 
message when the function is called:
Unsupported encoding '%s'. Please install iconv, GNU recode or mbstring 
for PHP.

Steven Wittens

More information about the drupal-devel mailing list