Jump to content

Recommended internal encoding for PHP


NotionCommotion

Recommended Posts

I look at my phpinfo() output, and it has ISO-8859-1 and ISO-8859-15 all over it.  UTF is not listed once.

 

Furthermore, mb_internal_encoding() displays it as ISO-8859-1.

 

For the most part, I stick to the default settings unless I have a specific reason to change.

 

Should I be changing php.ini to use UTF-8?  If so, any specific advice how to do so?  This whole encoding issue has been causing me major grief today :(

Link to comment
Share on other sites

As long as you use the same thing everywhere, and that isn't the GBK encoding (which is for Chinese so I doubt you would), you'll be fine.

 

Latin1 (ISO 8859-1) vs UTF-8 is a question of what characters you want to support. UTF-8 would be a great choice because it supports much, much more than Latin1 does.

Edited by requinix
typo
Link to comment
Share on other sites

All those encoding settings are irrelevant unless you actually use them. Do you?

 

For example, the internal encoding of the mb extension is only used as a default value for a couple of mb_* functions. If you don't use those, or if you always declare the encoding explicitly, then why care about the default encoding?

Link to comment
Share on other sites

Thanks requinix and jacques,

 

In regards to Chinese, are we talking Mandarin or Cantonese?  I actually could count to ten in Cantonese :)  Don't know the alphabet, so guess I don't need to go there.

 

In regards to using the mb extensions, yes, I unfortunately recently needed to do so.  I must read a file and look at the first few bytes of each line, and parse the rest of the line as appropriate.  Took me for a loop.

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.