Martijn van Oosterhout <kleptog@svana.org> writes:
> It does seem to be a bit wierd. For single character encodings anything
> up to 255 is OK, well, sort of. It depends on what you want chr() to do
> (oh no, not this discussion again). If you subscribe to the idea that
> it should use unicode code points then the test is completely bogus,
> since whether or not the character is valid has nothing to with whether
> the encoding is multibyte or not.
Well, the advertised purpose of the chr() changes was to prevent
generation of invalid multibyte sequences, not to cut off
potentially-useful functionality. So I don't think it should be
preventing people from generating non-ASCII single-byte characters.
The test is clearly backwards, because in an MB encoding it will in fact
let you generate invalid encoding ...
regards, tom lane