Does wide character input/output in C always read from / write to the correct (system default) encoding?

前端 未结 3 912
梦毁少年i
梦毁少年i 2021-01-02 09:11

I\'m primarily interested in the Unix-like systems (e.g., portable POSIX) as it seems like Windows does strange things for wide characters.

Do the read and write wid

3条回答
  •  情话喂你
    2021-01-02 09:59

    Don't use fputs with anything else than ASCII.

    If you want to write down lets say UTF8, then use a function who return the real size used by the utf8 string and use fwrite to write the good number of bytes, without worrying of vicious '\0' inside the string.

提交回复
热议问题