Commit b5ff87c
committed
Fix mbstring support for CP1252 encoding
It's a bit surprising how much was broken here.
- Identify filter was utterly and completely wrong.
- Instead of handling invalid CP1252 bytes as specified by
`mb_substitute_character`, it would convert them to Unicode 0xFFFD
(generic replacement character).
- When converting ISO-8859-1 to CP1252, invalid ISO-8859-1 bytes would
be passed through silently.
- Unicode codepoints from 0x80-0x9F were converted to CP1252 bytes 0x80-0x9F,
which is wrong.
- Unicode codepoint 0xFFFD was converted to CP1252 0x9F, which is very wrong.
Also clean up some unneeded code, and make the conversion table consistent with
others by using zero as a 'invalid' marker, rather than 0xFFFD.1 parent 2ce15d9 commit b5ff87c
File tree
2 files changed
+17
-34
lines changed- ext/mbstring/libmbfl/filters
2 files changed
+17
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 77 | | |
81 | 78 | | |
82 | | - | |
| 79 | + | |
83 | 80 | | |
84 | 81 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
90 | 85 | | |
91 | 86 | | |
92 | 87 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | 88 | | |
99 | | - | |
100 | | - | |
| 89 | + | |
101 | 90 | | |
102 | 91 | | |
| 92 | + | |
103 | 93 | | |
104 | 94 | | |
105 | 95 | | |
| |||
108 | 98 | | |
109 | 99 | | |
110 | 100 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | 101 | | |
115 | 102 | | |
116 | 103 | | |
117 | 104 | | |
118 | | - | |
| 105 | + | |
119 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
120 | 110 | | |
121 | 111 | | |
122 | 112 | | |
| |||
126 | 116 | | |
127 | 117 | | |
128 | 118 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | 119 | | |
136 | 120 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
141 | 124 | | |
142 | 125 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
0 commit comments