Jump to content

Encoded string problem.


mraiur

Recommended Posts

Hi i have to make a rss veed that has to be made in two encodings everything is working but when i preview the rss -> "An invalid character was found in text content" .

And when i saw the code there where "?" or "!" or "~!" something like this . And when i searched to find some answears it was a bug in PHP 4 that is fixed in PHP 5 but the problem is that the servers the feed is on my boss still refuse to upgrade to PHP 5 .

So is there any way to overcome this problem?

BTW: 1-encoding is UTF-8 and 2-encoding windows-1251

thx all

Link to comment
Share on other sites

its to much code to show i mean 1 i made was to cache all other is to read .

and the main problem is that a sentence witch is for example in bulgarian in utf-8 is 8 symbols  "Бългаски" but strlen shows its 16 symbols and substring for example cuts the string in the starting of the symbol ... i think :(

Link to comment
Share on other sites

I'm fairly sure that you can only have one charset in a document, you cannot use a mixture of charsets. So if you are trying to use a mixture of charsets, your problem probably lies there.

 

How exactly are you using this combination of charsets?

Link to comment
Share on other sites

yea :(

 

That didn't really answer my question, but it's ok, I'm pretty sure I understand your problem. You will need to enable the mbstring (multi-byte string) library in php (it's not usually enabled by default), and then use the mbstring functions to cut the feed at 100 characters. This should solve your problem.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.