Akuli / jou

Yet another programming language
MIT License
11 stars 4 forks source link

Output Chinese characters generate garbled characters #392

Closed littlewhitecloud closed 10 months ago

littlewhitecloud commented 1 year ago

image I want:

你好,世界

Result:

浣犲ソ锛屼笘鐣

Is there something wrong with encoding settings? code:

import "stdlib/io.jou"

def main() -> int:
    printf("%s", "你好,世界")
    return 0
littlewhitecloud commented 1 year ago

image successed in cplusplus with printf, but failed in jou with printf

littlewhitecloud commented 1 year ago

image

Akuli commented 1 year ago

Encodings are really hard to get right on Windows. I haven't put any effort into that with Jou. For now you could try different terminals (cmd.exe, git bash, powershell).

littlewhitecloud commented 1 year ago

I just found the solution: chcp 65001 If it only happeneds on windows, maybe I can add a check(If output char is chinese, do chcp 65001)