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

llama-bench : set locale to utf8 #2832

Merged
merged 1 commit into from
Aug 28, 2023
Merged

llama-bench : set locale to utf8 #2832

merged 1 commit into from
Aug 28, 2023

Conversation

slaren
Copy link
Collaborator

@slaren slaren commented Aug 27, 2023

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

@@ -916,6 +918,9 @@ static void llama_null_log_callback(enum llama_log_level level, const char * tex
}

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
Collaborator 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.

4 participants