Jump to content

How to unserialize UTF-8-serialized CP1251 representation of string?


r.osmanov

Recommended Posts

Hi there!

 

You should have considered it strange, but I really need this kind of conversion.

 

Content is fetched throught Smarty templates, and everything works fine with UTF-8.

But I have to deal with CP1251(Windows-1251) also, in order to make an XML export to one of Russian services.

 

I just

set names cp1251;

before fetching from DB and saving the template code. However, I've a serialize()'d field in DB that couldn't be unserialized in Smarty modifier function like

 

function smarty_modifier_unserialize($string){
    if ($string) 
        return unserialize($string);
    return false;
}

since it should deal just with UTF-8.

 

Is there a walkaround? Maybe I should write kinda special bynary unserialize function?

 

Regards.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.