question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Console logging output can not display non-ASCII charactors correctly

See original GitHub issue

Type of JetBrains IDE (IntelliJ, PyCharm, etc.) and version

pycharm pro 2021.2.3

Operating System

Windows11 Pro 21H2 Chinese version ()

TeXiFy IDEA version

0.7.12

What I did (steps to reproduce)

Minimal example to reproduce the problem

file 1. main.tex

\documentclass{article}
\usepackage{ctex} % the package ctex is for chinese output
\begin{document}
    \cite{测试test} % add a cite with non-ASCII charactor
    \bibliographystyle{plain}
    \bibliography{bibfile}
\end{document}

file 2. bibfile.bib

@phdthesis{测试test,
  title  = {测试test}
}

use engine latexmk with -xelatex to compile, and all file is in utf-8 encoding.

Expected behavior

image the warning should be show like LaTeX Warning: Citation `测试test’ on page 1 undefined on input line 4. image

Actual behavior

image But it shows LaTeX Warning: Citation `娴嬭瘯test’ on page 1 undefined on input line 4.

and 娴嬭瘯 is 测试 display in error encoding, it should display in utf-8, but actually it display in GBK.

What’s more

It’s a encoding error, Windows in Chinese use GBK as its default encoding, but I set UTF-8 in pycharm and Windows image image set UTF-8 as default encoding with cmd and programs image Use cmd or powershell to complie the tex file, the logging will not display in error encoding. And others in pycharm like python output non-ASCII charactors in console is correct.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
PHPiratescommented, Nov 30, 2021

Okay I installed the kaiti and simhei fonts and can reproduce the problem on Windows, and for me it looks even worse:

image

but I think I found a solution: go to Help > Edit custom VM options, add -Dfile.encoding=UTF-8 and restart PyCharm. Does that solve it for you as well?

If it works, we should definitely add this to the wiki.

1reaction
PHPiratescommented, Dec 1, 2021

used by default in the legacy components of Microsoft Windows

I didn’t know Windows had any components that are not legacy 😆

Added it to the wiki: https://github.com/Hannah-Sten/TeXiFy-IDEA/wiki/Unicode

别客气!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug: Console logs stop updating when non-ascii characters ...
Scrolling console log should continue to scroll and correctly display all characters. Raw output should correctly display all characters.
Read more >
Weird non-ASCII Characters in Console Output - Stack Overflow
Some displays simply several blank spaces, others display single weird ascii characters. Image example: The code worked fine and I was having ...
Read more >
Why is it so HARD to have Windows 10 CMD console display ...
It has been year 2022 now, I'm wondering why Microsoft makes it so hard for a user to view Unicode characters correctly and...
Read more >
Running the Java project by using the JDK 18 prints the ...
Make sure this project is using the JDK 18. Run it. Result: (see the output in the Terminal VS the Console in the...
Read more >
Logging in .NET Core and ASP.NET Core | Microsoft Learn
A specific log provider is not specified, so LogLevel applies to all the enabled ... The Console provider logs output to the console....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found