mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix legacy conversion filter for ISO-2022-KR
This commit is contained in:
parent
8a915ed26c
commit
6d525a425e
2 changed files with 17 additions and 12 deletions
|
@ -190,6 +190,14 @@ int mbfl_filt_conv_wchar_2022kr(int c, mbfl_convert_filter *filter)
|
|||
{
|
||||
int c1, c2, s = 0;
|
||||
|
||||
if ((filter->status & 0x100) == 0) {
|
||||
CK((*filter->output_function)(0x1b, filter->data)); /* ESC */
|
||||
CK((*filter->output_function)('$', filter->data));
|
||||
CK((*filter->output_function)(')', filter->data));
|
||||
CK((*filter->output_function)('C', filter->data));
|
||||
filter->status |= 0x100;
|
||||
}
|
||||
|
||||
if (c >= ucs_a1_uhc_table_min && c < ucs_a1_uhc_table_max) {
|
||||
s = ucs_a1_uhc_table[c - ucs_a1_uhc_table_min];
|
||||
} else if (c >= ucs_a2_uhc_table_min && c < ucs_a2_uhc_table_max) {
|
||||
|
@ -211,9 +219,7 @@ int mbfl_filt_conv_wchar_2022kr(int c, mbfl_convert_filter *filter)
|
|||
/* exclude UHC extension area */
|
||||
if (c1 < 0xa1 || c2 < 0xa1) {
|
||||
s = c;
|
||||
}
|
||||
|
||||
if (s & 0x8000) {
|
||||
} else if (s & 0x8000) {
|
||||
s -= 0x8080;
|
||||
}
|
||||
|
||||
|
@ -235,13 +241,6 @@ int mbfl_filt_conv_wchar_2022kr(int c, mbfl_convert_filter *filter)
|
|||
}
|
||||
CK((*filter->output_function)(s, filter->data));
|
||||
} else {
|
||||
if ((filter->status & 0x100) == 0) {
|
||||
CK((*filter->output_function)(0x1b, filter->data)); /* ESC */
|
||||
CK((*filter->output_function)('$', filter->data));
|
||||
CK((*filter->output_function)(')', filter->data));
|
||||
CK((*filter->output_function)('C', filter->data));
|
||||
filter->status |= 0x100;
|
||||
}
|
||||
if ((filter->status & 0x10) == 0) {
|
||||
CK((*filter->output_function)(0x0e, filter->data)); /* shift out */
|
||||
filter->status |= 0x10;
|
||||
|
@ -259,7 +258,7 @@ int mbfl_filt_conv_wchar_2022kr(int c, mbfl_convert_filter *filter)
|
|||
static int mbfl_filt_conv_any_2022kr_flush(mbfl_convert_filter *filter)
|
||||
{
|
||||
/* back to ascii */
|
||||
if (filter->status & 0xff00) {
|
||||
if (filter->status & 0x10) {
|
||||
CK((*filter->output_function)(0x0f, filter->data)); /* shift in */
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,12 @@ if (mb_language("korean")) {
|
|||
mb_send_mail($to, "테스트 ".mb_language(), "테스트");
|
||||
readfile(__DIR__ . "/mb_send_mail07.eml");
|
||||
}
|
||||
|
||||
/* Note: The subject line below, "=?ISO-2022-KR?B?GyQpQw5FVz06Ri4PIEtvcmVhbg==?=",
|
||||
* used to be "=?ISO-2022-KR?B?GyQpQw5FVz06Ri4PIEtvcmVhbg8=?=". That was because
|
||||
* the Base64-encoded ISO-2022-KR string contained an extraneous 0xF ('shift out')
|
||||
* byte. 'Shift out' is only needed to return to ASCII mode, but the string
|
||||
* contained one despite already being in ASCII mode. */
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
|
@ -42,7 +48,7 @@ Content-Transfer-Encoding: %s
|
|||
|
||||
%s
|
||||
To: example@example.com
|
||||
Subject: =?ISO-2022-KR?B?GyQpQw5FVz06Ri4PIEtvcmVhbg8=?=
|
||||
Subject: =?ISO-2022-KR?B?GyQpQw5FVz06Ri4PIEtvcmVhbg==?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=ISO-2022-KR
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue