Re: How should PEAR packages support multiple character sets?
| From: | till | Date: | Tue, 25 Mar 2008 20:11:50 +0000 |
| Subject: | Re: How should PEAR packages support multiple character sets? | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-49548@lists.php.net to get a copy of this message | ||
On Tue, Mar 25, 2008 at 3:37 PM, Christian Schmidt <lists@chsc.dk> wrote:
> 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.
Subjective? Maybe, but hey, I could argue that the standard is
ISO-8859-15 (Euro symbol, anyone? ;-)) but isn't UTF-8 a standard
already? I mean most email clients send UTF-8 today, most websites are
UTF-8 (all browsers support it), most APIs expect it as well.
Non-UTF-8 charsets are really a pain to deal with. So why not just use
this standard and document it like - "you will need to pass UTF-8 in".
Or for example you use mb's functions to detect charsets and convert
them to UTF-8 on the fly. Though I think that's too expensive and
people should just pass it in already and convert it themselves if
they don't already have UTF-8.
Till