Skip to content

Commit

Permalink
Remove duplicate implementation of CP932 from mbstring
Browse files Browse the repository at this point in the history
Sigh. Double sigh. After fruitlessly searching the Internet for information on
this mysterious text encoding called "SJIS-open", I wrote a script to try
converting every Unicode codepoint from 0-0xFFFF and compare the results from
different variants of Shift-JIS, to see which one "SJIS-open" would be most
similar to.

The result? It's just CP932. There is no difference at all. So why do we have
two implementations of CP932 in mbstring?

In case somebody, somewhere is using "SJIS-open" (or its aliases "SJIS-win" or
"SJIS-ms"), add these as aliases to CP932 so existing code will continue to
work.
  • Loading branch information
alexdowad committed Jun 17, 2021
1 parent 7502c86 commit e245985
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 360 deletions.
1 change: 0 additions & 1 deletion ext/mbstring/config.m4
Expand Up @@ -117,7 +117,6 @@ AC_DEFUN([PHP_MBSTRING_SETUP_LIBMBFL], [
libmbfl/filters/mbfilter_qprint.c
libmbfl/filters/mbfilter_singlebyte.c
libmbfl/filters/mbfilter_sjis.c
libmbfl/filters/mbfilter_sjis_open.c
libmbfl/filters/mbfilter_sjis_mobile.c
libmbfl/filters/mbfilter_sjis_mac.c
libmbfl/filters/mbfilter_sjis_2004.c
Expand Down
2 changes: 1 addition & 1 deletion ext/mbstring/config.w32
Expand Up @@ -26,7 +26,7 @@ if (PHP_MBSTRING != "no") {
mbfilter_ucs4.c mbfilter_uhc.c mbfilter_utf16.c mbfilter_utf32.c \
mbfilter_utf7.c mbfilter_utf7imap.c mbfilter_utf8.c \
mbfilter_utf8_mobile.c mbfilter_euc_jp_2004.c mbfilter_uuencode.c \
mbfilter_cp5022x.c mbfilter_sjis_open.c mbfilter_sjis_mobile.c \
mbfilter_cp5022x.c mbfilter_sjis_mobile.c \
mbfilter_sjis_mac.c mbfilter_iso2022jp_2004.c \
mbfilter_iso2022jp_mobile.c mbfilter_singlebyte.c \
mbfilter_tl_jisx0201_jisx0208.c", "mbstring");
Expand Down
2 changes: 1 addition & 1 deletion ext/mbstring/libmbfl/filters/mbfilter_cp932.c
Expand Up @@ -54,7 +54,7 @@ static const unsigned char mblen_table_sjis[] = { /* 0x80-0x9f,0xE0-0xFF */
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
};

static const char *mbfl_encoding_cp932_aliases[] = {"MS932", "Windows-31J", "MS_Kanji", NULL};
static const char *mbfl_encoding_cp932_aliases[] = {"MS932", "Windows-31J", "MS_Kanji", "SJIS-win", "SJIS-ms", "SJIS-open", NULL};

const mbfl_encoding mbfl_encoding_cp932 = {
mbfl_no_encoding_cp932,
Expand Down
308 changes: 0 additions & 308 deletions ext/mbstring/libmbfl/filters/mbfilter_sjis_open.c

This file was deleted.

43 changes: 0 additions & 43 deletions ext/mbstring/libmbfl/filters/mbfilter_sjis_open.h

This file was deleted.

1 change: 0 additions & 1 deletion ext/mbstring/libmbfl/mbfl/mbfl_convert.c
Expand Up @@ -44,7 +44,6 @@
#include "filters/mbfilter_euc_kr.h"
#include "filters/mbfilter_iso2022_kr.h"
#include "filters/mbfilter_sjis.h"
#include "filters/mbfilter_sjis_open.h"
#include "filters/mbfilter_sjis_2004.h"
#include "filters/mbfilter_sjis_mobile.h"
#include "filters/mbfilter_sjis_mac.h"
Expand Down

0 comments on commit e245985

Please sign in to comment.