Re: How should PEAR packages support multiple character sets?

From: Date: Tue, 25 Mar 2008 14:37:00 +0000
Subject: Re: How should PEAR packages support multiple character sets?
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-49543@lists.php.net to get a copy of this message
Jan Schneider wrote:
I don't. It really depends on the package. For some packages it simply makes sense to assume utf-8 encoding, especially packages dealing with dom and xml, but probably also others. In your opinion, what kind of package that deals with non-US-ASCII characters should use a character set other than UTF-8?
This has to be documented of course. I agree. Asssumptions like this should be documented properly. Perhaps it should even be a requirement that the expected encoding is mentioned in all @param and @return tags that refer to strings. This would also make the information available in the tooltip in IDEs.
But it doesn't make sense to force passing a charset to those package that work in a certain context where utf-8 is basically the standard. I disagree. If your code generally assumes that strings are ISO-8859-1, it would be convenient if the DOM extension would all all strings to be ISO-8859-1 rather than UTF-8. Also, I think it is rather subjective which character sets are considered standard in a given context.
Thus, the charset should be passed directly to packages, object ctors, or even methods where it fits best for each package. If we choose that approach, I suggest that we agree on a uniform way of specifying the character set in constructors etc.
Christian

« previous php.pear.dev (#49543) next »