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.

processing.py could not show chinese char corectly

See original GitHub issue

processing java mode could show Chinsese char crorectly

textFont(createFont("KaiTi",20));
text("年后",0,20);

image

but this code could not work in processing python mode image seems there’s something wrong when processing text in processing editor or python char encoding

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
villarescommented, Dec 9, 2018

Hi @yonghuming and @lhcui !

As Processing Python Mode is based on Python 2 (Jython) you have to indicate a Unicode string with a u (like Pydo did) or at the start of your sketch you can ask for “Unicode literals” as in Python 3:

from __future__ import unicode_literals

fill(0)
size(600, 480)
textFont(createFont("KaiTi", 60))
text('原来可以支持中文', 0, 100)
println('原来可以支持中文')

0reactions
yonghumingcommented, Feb 15, 2019

Hi @yonghuming and @lhcui !

As Processing Python Mode is based on Python 2 (Jython) you have to indicate a Unicode string with a u (like Pydo did) or at the start of your sketch you can ask for “Unicode literals” as in Python 3:

from __future__ import unicode_literals

fill(0)
size(600, 480)
textFont(createFont("KaiTi", 60))
text('原来可以支持中文', 0, 100)
println('原来可以支持中文')

thank you i have fixed do not need import unicode_literals

Read more comments on GitHub >

github_iconTop Results From Across the Web

processing python mode can't output Chinese character.
processing python mode can't output Chinese character. #280 ... python mode display Chinese word. #here is my code size(500,500)
Read more >
how to show the chinese characters in tsv/xlsm/csv in ...
i found only english can show in processing, no other characters. i need to display chinese characters in processing, who can help me...
Read more >
Python decoding issue with Chinese characters
The recipientContent is obtained from an API call. I do not need to have the Chinese characters in the output file. Any advice...
Read more >
PyCharm Editor cannot display Chinese characters correctly.
After updating to version 2019.2, Chinese characters are not displayed correctly in Editor (Attachment 1). I've checked file encoding settings (Attachment 2), ...
Read more >
Unidecode
Unidecode 1.3.6 · Module content. This library contains a function that takes a string object, possibly containing non-ASCII characters, and returns a string ......
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