Jump to content

Convert STRING charset


AndieB

Recommended Posts

Hi all Gurus!

 

I have a MySQL database, which stores data in UTF-8 Unicode format.

I have a webpage which has a form where I enter data to store the information and the CHARSET for that page is ISO-8859-1 (latin1).

 

When I fetch data from my database on a page that has the CHARSET ISO-8859-1 the output is great!

But when I now from another page has UTF-8 Unicode CHARSET set and fetch data from the database, some of the characters are messed up (like the Swedish Å Ä Ö characters).

 

My question follows:

Can I with PHP, fetch text from my database into a STRING and then "convert" from ISO-8859-1 to UTF-8 Unicode before outputting it to the page which has CHARSET UTF-8 Unicode?

 

OR

 

Do I have to "loop" through and replace "bad/wrong" characters into UTF-8 Unicode, and if so, HOW?

 

I am thankful for any kind of help!

 

Sincerely,

Andreas

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.