Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixed character encoding in lpstat output #159

Closed
frifl opened this issue Mar 23, 2021 · 3 comments
Closed

Mixed character encoding in lpstat output #159

frifl opened this issue Mar 23, 2021 · 3 comments
Assignees
Labels
bug Something isn't working priority-high
Milestone

Comments

@frifl
Copy link

frifl commented Mar 23, 2021

This issue was referenced here from apple/CUPS : apple/cups#5896

I run CUPS 2.3.1 on Ubuntu 20.04 and I get mixed character encoding in the output from lpstat. The system locale is set to zh_CN.GB18030. The message is UTF-8 and the timestamp is GB18030.

$ lpstat -a
printer 鑷粠 2021年02月04日 星期四 07时51分54秒 寮�濮嬫帴鍙楄姹�

The timestamp is correct but there are replacement characters in the message part which indicate bad encoding. I checked that the message part was indeed UTF-8 by manually decoding the bytes.

This is my locale setting:

$ locale
LANG=zh_CN.GB18030
LANGUAGE=
LC_CTYPE="zh_CN.GB18030"
LC_NUMERIC="zh_CN.GB18030"
LC_TIME="zh_CN.GB18030"
LC_COLLATE="zh_CN.GB18030"
LC_MONETARY="zh_CN.GB18030"
LC_MESSAGES="zh_CN.GB18030"
LC_PAPER="zh_CN.GB18030"
LC_NAME="zh_CN.GB18030"
LC_ADDRESS="zh_CN.GB18030"
LC_TELEPHONE="zh_CN.GB18030"
LC_MEASUREMENT="zh_CN.GB18030"
LC_IDENTIFICATION="zh_CN.GB18030"
LC_ALL=

This is the locales I have on my system:

$ locale -a
C
C.UTF-8
POSIX
zh_CN.gb18030
@michaelrsweet
Copy link
Member

The issue is that libcups doesn't recognize the character set name "GB18030". Investigating...

@michaelrsweet michaelrsweet self-assigned this Mar 23, 2021
@michaelrsweet michaelrsweet added the investigating Investigating the issue label Mar 23, 2021
@michaelrsweet
Copy link
Member

GB18030 replaces GB2312 aka Windows code page 936. So we need to add it to the cups_encoding_t enum and the name table, then the right things should happen...

@michaelrsweet michaelrsweet added bug Something isn't working priority-high and removed investigating Investigating the issue labels Mar 23, 2021
@michaelrsweet michaelrsweet added this to the v2.4.0 milestone Mar 23, 2021
@michaelrsweet
Copy link
Member

[master e0c9fdc] Add GB18030 charset support for localization (Issue #159)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-high
Projects
None yet
Development

No branches or pull requests

2 participants