[dev] [commits] Horde branch master updated. 6d97c196be61e3bca4413767f7b6f4d12b62fefd

Michael M Slusarz slusarz at horde.org
Thu Mar 4 22:18:22 UTC 2010


Quoting Jan Schneider <jan at horde.org>:

> Zitat von Michael M Slusarz <slusarz at horde.org>:
>
>> daf7a5e Added Horde_Util::convertToUtf8().
>
> This should be in Horde_String.

I'm not sure I agree.  This function does not necessarily work on  
strings - i.e. you can pass an object to convertToUtf8() and it will  
return an object.  All the rest of the Horde_String functions are  
solely related to string data only (they either return string data or,  
for length(), it accepts string data).

Truthfully, I'm not sure if there is much use for this function  
outside of Horde_Serialize().  There is certainly no need to use  
Horde_String::convertCharset() in it - utf8_encode() is sufficient and  
using convertCharset() is overkill.  The function is quite honestly a  
bit of a hack - essentially in Horde_Serialize it is a way to remove  
non UTF-8 data from a supposed UTF-8 string so that json_encode()  
doesn't die when parsing a string.  Ideally, in the future, this would  
be done within json_encode() itself by passing it an option value  
telling it to ignore non UTF-8 characters contained in a string.

I do agree that there is a bunch of other functions in Horde_Util that  
should be moved to Horde_String - things like uriB64[Encode|Decode](),  
strftime2date(), and date2strftime().

michael

-- 
___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list