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

engine.eval without assigned stdout does not handle Unicode correctly #34

Closed
allefeld opened this issue Sep 11, 2023 · 5 comments
Closed

Comments

@allefeld
Copy link

allefeld commented Sep 11, 2023

Example: The Unicode character '→' (U+2192) appears in the output as U+001A.

image

That does not happen if the stdout argument is assigned to a StringIO instance.

image

However, the disadvantage is that output assigned to stdout is heavily buffered. If I have a long-running computation which continuously produces output, I have to choose between proper Unicode output and immediate feedback.

I though this might be a property of StringIO, and tried to intercept write calls.

image

But from the result it is clear that stdout.write is only called once. I also tried to induce flushing by inserting newline characters in the output, with no success.

@allefeld
Copy link
Author

allefeld commented Oct 2, 2023

Just tested with R2023b and matlabengine 23.2.1, and the bug remains.

@alanfmw, not sure whether these issues are actually monitored?

@alanfmw
Copy link
Member

alanfmw commented Oct 3, 2023

@allefeld, we will look into this.

@allefeld
Copy link
Author

Are there any news on this?

@alanfmw
Copy link
Member

alanfmw commented Apr 18, 2024

R2024a contains a fix. On Linux and Mac, with UTF-8 display, you will now see the Unicode character displayed correctly. On Windows, it depends on the machine locale. On a Chinese machine, we saw the Unicode output written to the Windows console correctly, but on a US machine, the Unicode output to the Windows console was swallowed, and changing the code page with chcp didn't help. Which platform are you using?

@allefeld
Copy link
Author

allefeld commented Apr 19, 2024

Great, I'll check it out!

I'm on Linux, Debian 12.5.

Edit: Can confirm it is fixed with R2024a on Linux.

@allefeld allefeld closed this as completed Oct 7, 2024
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

No branches or pull requests

2 participants