Skip to content

Conversation

@slaren
Copy link
Member

@slaren slaren commented Aug 27, 2023

Fixes garbled utf-8 characters in markdown printer under Windows 10 version 1803 and up.


int main(int argc, char ** argv) {
// try to set locale for unicode characters in markdown
setlocale(LC_CTYPE, ".UTF-8");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On non-Windows platforms this is going to fail and return NULL. I think we should wrap this with #ifdef _WIN32.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but if it fails nothing changes anyway, so I don't see the point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but if it fails nothing changes anyway, so I don't see the point.

I can confirm, nothing happens on Linux, locale stays what it was before the setlocale(LC_CTYPE, ".UTF-8"); call, no exceptions, no errors.

@slaren slaren merged commit 43033b7 into master Aug 28, 2023
@slaren slaren deleted the llama-bench-utf8 branch August 28, 2023 17:19
akawrykow pushed a commit to akawrykow/llama.cpp that referenced this pull request Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants