소스 검색

iconv: add euro symbol to GBK as single byte 0x80

this is how it's defined in the cp936 document referenced by the IANA
charset registry as defining GBK, and of the mappings defined there,
was the only one missing.

it is not accepted for GB18030, as GB18030 is a UTF and has its own
unique mapping for the euro symbol.
Rich Felker 1 년 전
부모
커밋
ca6f46aff1
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/locale/iconv.c

+ 4 - 0
src/locale/iconv.c

@@ -403,6 +403,10 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
 			if (c < 128) break;
 			if (c < 0xa1) goto ilseq;
 		case GBK:
+			if (c == 128) {
+				c = 0x20ac;
+				break;
+			}
 		case GB18030:
 			if (c < 128) break;
 			c -= 0x81;