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

Chinese word support? #27

Closed
hushanhsiang opened this issue Jan 21, 2018 · 6 comments

Comments

Projects
None yet
2 participants
@hushanhsiang
Copy link

commented Jan 21, 2018

Can Chaquopy support Chinese word?
I tried to display/indicate Chinese words with print() and setText() function in python file but got problem while Gradle build.
Suck like:
self.findViewById(R.id.tvx).setText("中文!!")
or
print("中文")

Even use # for comment with Chinese words:
#print("中文")

The Grandle Error:

  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\AndroidProjects\Chaquopy\hello\app\build\generated\python\build-packages.zip\chaquopy\static_proxy.py", line 469, in <module>
  File "C:\AndroidProjects\Chaquopy\hello\app\build\generated\python\build-packages.zip\chaquopy\static_proxy.py", line 54, in main
  File "C:\AndroidProjects\Chaquopy\hello\app\build\generated\python\build-packages.zip\chaquopy\static_proxy.py", line 168, in process
UnicodeDecodeError: 'cp950' codec can't decode byte 0x96 in position 624: illegal multibyte sequence

 FAILED
:app:buildInfoGeneratorDebug

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:generateDebugPythonProxies'.
> Process 'command 'python'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s

11 actionable tasks: 4 executed, 7 up-to-date

@mhsmith mhsmith added the bug label Jan 21, 2018

@mhsmith

This comment has been minimized.

Copy link
Member

commented Jan 21, 2018

Thanks, we'll take a look at it.

@hushanhsiang

This comment has been minimized.

Copy link
Author

commented Jan 21, 2018

Not at all, you are good.

@mhsmith

This comment has been minimized.

Copy link
Member

commented Jan 26, 2018

Fixed in Chaquopy version 1.3.1.

@mhsmith mhsmith closed this Jan 26, 2018

@hushanhsiang

This comment has been minimized.

Copy link
Author

commented Jan 27, 2018

The Chinese words can be displayed.
Thanks a lot.

@mhsmith

This comment has been minimized.

Copy link
Member

commented Jan 28, 2018

I forgot to mention: your error indicates that your source file actually was in UTF-8, which is now the default for Chaquopy. If in the future you ever have a source file which is in CP950 (Big5) encoding, perhaps because you're using a different editor, then you'll have to indicate that with a comment as described in PEP 263.

@hushanhsiang

This comment has been minimized.

Copy link
Author

commented Jan 28, 2018

Ok, thank you for the hint.
Big5 Code is always a trouble but Widows used it for the traditional Chinese version, UTF-8 is preferred decoding.
Thank you for fixed this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.