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

添加 target:gb2312 以满足中文兼容性 #4813

Closed
ruiyuanlu opened this issue Mar 9, 2024 · 5 comments
Closed

添加 target:gb2312 以满足中文兼容性 #4813

ruiyuanlu opened this issue Mar 9, 2024 · 5 comments

Comments

@ruiyuanlu
Copy link

ruiyuanlu commented Mar 9, 2024

Is your feature request related to a problem? Please describe.

当前的 xmake api 检查 set_encodings 时仅支持 utf-8 对于 gb2312 xmake 做 api 检查时会给出 warning

warning: .\xmake.lua:51: unknown encoding value 'target:gb2312', it may be 'target:utf-8'

出于跨平台兼容性需要,希望代码本身用 utf-8 存储, 在 Linux 上使用 utf-8, 但是在 win 上需要避免中文乱码, gb2312 对应 CodePage 936 所以需要增加 target:gb2312 支持

CodePage 和编码名称的对应关系参考的是:https://learn.microsoft.com/zh-cn/windows/win32/Intl/code-page-identifiers

Describe the solution you'd like

API 检查

encodings.lua 添加对 target:gb2312 检查

-- imports
import(".api_checker")

function main(opt)
    opt = opt or {}
    api_checker.check_targets("encodings", table.join(opt, {values = {
        "none", "utf-8", "source:utf-8", "target:utf-8", "target:gb2312"}}))
end

添加 nf_encodings 处理

cl.luagcc.lua 中添加对 gb2312 的处理

local charsets = {
        ["utf-8"] = "utf-8",
        utf8 = "utf-8",
        gb2312 = "gb2312"
    }

Describe alternatives you've considered

NO

Additional context

NO

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: Add target:gb2312 to meet Chinese compatibility

@waruqi
Copy link
Member

waruqi commented Mar 9, 2024

再试试,xmake update -s dev

@waruqi waruqi added this to the v2.8.9 milestone Mar 9, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Try again, xmake update -s dev

@ruiyuanlu
Copy link
Author

OK,没什么问题,thx

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


OK, no problem, thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants