locales: Fix eucJP sorting (broken upstream?)
Sorting eucJP text with "sort" resulted in an illegal sequence while "gsort" worked. This was traced back to mbrtowc handling which was broken for eucJP (probably eucCN, eucKR, and eucTW as well). This small fix took hours to figure out. The OR operation to build the wide character requires an unsigned character to work correctly. The euc wcrtowc conversion is probably broken upstream in Illumos as well. Triggered by: misc/freebsd-doc-ja in ports (encoded in eucJP) Submitted by: marino Obtained from: DragonflyBSD
This commit is contained in:
parent
d79cdd21de
commit
d8ed03efe5
@ -317,8 +317,8 @@ _EUC_mbrtowc_impl(wchar_t * __restrict pwc, const char * __restrict s,
|
||||
{
|
||||
_EucState *es;
|
||||
int i, want;
|
||||
wchar_t wc;
|
||||
unsigned char ch;
|
||||
wchar_t wc = 0;
|
||||
unsigned char ch, chs;
|
||||
|
||||
es = (_EucState *)ps;
|
||||
|
||||
@ -367,7 +367,8 @@ _EUC_mbrtowc_impl(wchar_t * __restrict pwc, const char * __restrict s,
|
||||
|
||||
for (i = 0; i < MIN(want, n); i++) {
|
||||
wc <<= 8;
|
||||
wc |= *s;
|
||||
chs = *s;
|
||||
wc |= chs;
|
||||
s++;
|
||||
}
|
||||
if (i < want) {
|
||||
|
Loading…
Reference in New Issue
Block a user