Hello,
i am practising with charsets at the moment and so i thought:
-> How does PHP know the charset i use in my source-code?
-> Are php-sources limited to specific charsets?
-> In which areas you have to be aware of the source-code-charset?
Perhaps somebody here on the list can tell something about these issues?
Thanks!
--
drylser
Hello,
i am practising with charsets at the moment and so i thought:
-> How does PHP know the charset i use in my source-code?
-> Are php-sources limited to specific charsets?
-> In which areas you have to be aware of the source-code-charset?Perhaps somebody here on the list can tell something about these issues?
Thanks!
Unless I'm mistaken, PHP expects the source files to be in the
internal charset, which is ISO-8859-1. If you use the mbstring
extension, you can use different internal encodings. See:
http://www.php.net/mbstring
Another good read on charset vs. PHP is:
http://www.phpwact.org/php/i18n/charsets?s=utf
--
troels
Hello,
i am practising with charsets at the moment and so i thought:
-> How does PHP know the charset i use in my source-code?
-> Are php-sources limited to specific charsets?
-> In which areas you have to be aware of the source-code-charset?Perhaps somebody here on the list can tell something about these issues?
Thanks!Unless I'm mistaken, PHP expects the source files to be in the
internal charset, which is ISO-8859-1. If you use the mbstring
extension, you can use different internal encodings. See:
http://www.php.net/mbstringAnother good read on charset vs. PHP is:
http://www.phpwact.org/php/i18n/charsets?s=utf--
troels
I think, the problem may be divided into 2 areas:
- handling charsets of data (e.g. regex or string functions)
No unsolvable problem. You have to know (and/or validate) the charset of
the data you process, no matter if typed in in the source code or loaded
from other data sources. There are "tools and workarounds" available, to
do the things right.
- paying attention to the charset of the source code
This is the main issue, i wanted to address with my posting.
I asked myself, if there can be characters i use as source code, which
php perhaps can not recognize because of the charset i used in the
source-code-document.
Or perhaps in php are only characters "allowed", which are represented
all the same in all supported charsets, so there might be a list of
charsets, you can safely use when scripting php.
I mean, is there a difference (bytes?) writing the following in
iso-8859-1 or utf-8?
public function foo($bar = true) {
return self::SOME_CONSTANT;
}
And if there is a difference, how php knows what i typed?
So many questions .... :)
--
Greetings,
drysler
Hello,
i am practising with charsets at the moment and so i thought:
-> How does PHP know the charset i use in my source-code?
-> Are php-sources limited to specific charsets?
-> In which areas you have to be aware of the source-code-charset?Perhaps somebody here on the list can tell something about these issues?
Thanks!Unless I'm mistaken, PHP expects the source files to be in the
internal charset, which is ISO-8859-1. If you use the mbstring
extension, you can use different internal encodings. See:
http://www.php.net/mbstringAnother good read on charset vs. PHP is:
http://www.phpwact.org/php/i18n/charsets?s=utf--
troels
I think, the problem may be divided into 2 areas:
- handling charsets of data (e.g. regex or string functions)
No unsolvable problem. You have to know (and/or validate) the charset of
the data you process, no matter if typed in in the source code or loaded
from other data sources. There are "tools and workarounds" available, to
do the things right.
- paying attention to the charset of the source code
This is the main issue, i wanted to address with my posting.
I asked myself, if there can be characters i use as source code, which
php perhaps can not recognize because of the charset i used in the
source-code-document.
Or perhaps in php are only characters "allowed", which are represented
all the same in all supported charsets, so there might be a list of
charsets, you can safely use when scripting php.
I mean, is there a difference (bytes?) writing the following in
iso-8859-1 or utf-8?
public function foo($bar = true) {
return self::SOME_CONSTANT;
}
And if there is a difference, how php knows what i typed?
So many questions .... :)
--
Greetings,
drysler