[php-src] Issue #8308: The return value of mb_list_encodings() doesn't contain 'SJIS-win'

From: Date: Sat, 16 Apr 2022 23:25:14 +0000
Subject: [php-src] Issue #8308: The return value of mb_list_encodings() doesn't contain 'SJIS-win'
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241034@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8308 Comment Author: sj-i @alexdowad You have probably understood almost all the details necessary about this case, but I would like to emphasize the following point to be sure. It should be noted that what is important here is not conformance to any written standard or specific implementation of another product, but a bit vague *customs* and BC. Until 8.0, mbstring behaved differently from the current implementation. The reason behind this is not a formal standard, but an effort made for the convenience of users. Some code points had the same mappings in multiple OSS as it is *customs* from old ages. I've found yet another example in the JDK bug tracker. https://bugs.openjdk.java.net/browse/JDK-4361835 So, as we found, there are parts that are currently consistent with the MS best-fit mapping, the WHATWG specification, and the behavior of other converters. But even if there are differences with them in the implementation, I don't think they should be "fixed" to eliminate the differences, at least in minor versions, unless there is an obvious error that is to the detriment of the user. The long-standing behavior of PHP's mbstring itself is now part of the *customs* that our users rely on. The advice we can surely give to future core developers, in general, is as follows - In many cases, there is no standard to follow for mapping between Japanese legacy encodings and Unicode. - In some cases, it is not clear which way of mapping is the "correct" one. - Mappings that have existed for a long time may have users relying on any part of them. - If the mapping is to be changed, there must be enough benefit to balance the possible BC breaks. - If it is not an obvious bug, it should not be fixed in a minor release. - See https://github.com/php/php-src/issues/8308 for more detail :) > nobody should be using it for new, 'greenfield' development. I don't think anybody should use legacy encodings in their 'greenfield' development ^^ Joking aside, for the recommendations you listed, I think the following one should be fixed. > If you need to convert other, generic Unicode text to CP932, use SJIS-win. "If you need to convert U+00A5 (YEN SIGN) and U+203E (OVERLINE) from Unicode to full-width, use SJIS-win." I think it is appropriate to explain the behavior just as it is.

« previous php.bugs (#241034) next »