Special characters on android mode -- encoding problem

Hello all,

I’ve a problem with my sketch, everytime I have a text with special characters, with text() function or with println().
It works well on JAVA but makes strange characters on android mode!
reportingProcessingBug|690x415

I’ve tried to reinstall processing and android several times, but the problem continues.

I’ve tried to change the font, but it’s the same…Could someone please help me? Am I doing something wrong?
I think this bug started after processing’s update but I’m not sure about it…

Thanks in advance

You need to provide your code that demonstrates this bug. Don’t forget to provide details about your phone, target Android API, Processing version, Processing Android mode version.

I also suggest running examples code. In Android mode, run the UI sketch under the ketai examples.

Kf

hello Tiago,

I had the same issue trying to display french characters (e, è, à, … for example) on android. The only way that worked for me was to read the text from a csv file and using processing table.

Hope this helps. Peace.

PS: kfrajer processing does not handle special characters well :frowning:

Hello kfrajer,

Thanks for your answer, I’m new and it is my first post.
I’ve tried to provide the code example I used, but I see that the image seems to not open, I’ll try again:

(import processing.vr.*; << don’t take care about this, it was just a test)

  • my mobile phone is an Samsung S7 with the last version, I’ve tried with the emulator of processing, the problem is the same.
  • my processing version is 3.3.7.
  • processing android mode is 4.0.2

What’s interesting, is that the application was working fine, till yesterday, when I got a bug with processing was not launching and had to reinstall processing all over again.

Hello mokalux,
,

Yes it help’s =), in the case i’m not able to correct this problem, I’ll use your method about the csv file.

Thanks a lot

Maybe change PDE’s “Editor and Console Font”? :thinking:
Hit CTRL + Comma in order to access PDE’s “Preferences”. :nerd_face:

Thanks GoToLoop,

I’ve tried just at the moment, but it doesn’t work
reportingProcessingBug2

What I understand is that everything in my console is working on UTF-8 but the compiler of Android is working on ISO…is that possible?

And is it possible to change the compiler’s encoding?

Possibly look at setting the file.encoding system property to UTF-8. Depending on how the compiler is launched, might be easier via the environment variable mentioned at How to get and set default Character encoding or Charset in Java? Example

Thanks @neilcsmith, unfortunatly it didn’t resolve, the function seems to work on Java but not on Android. And even If I change on Java it still work but on Android it’s the same:
reportingProcessingBug4

@Tiago I may not have explained it very well. You need to set that for whatever is going to be running the compiler (not in your sketch). That’s why trying the environment variables might be a better way.

@neilcsmith ohh ok… not sure if I know how to do it, but I’ll try and then give a feedback, thanks again :slightly_smiling_face:

You’re on Windows 10? There’s a simple GUI editor in system settings somewhere. Probably try searching in the menu IIRC.

@neilcsmith Yes I’m on Windows 10, I’m sorry but I really don’t have any idea how to do it. :roll_eyes:
I’m not finding any gui editor :confused:

If you hit the Windows key and type environment variables is there nothing listed? If not, sorry I’ll have to refer you to Google as I don’t have access to my Windows testing machine at the moment and can’t remember which section it’s in.

Yes there is:

Yes, that’s the one. Clicking on the bottom button should open up a table where you can add / modify environment variables. You want to add (I think) one with the key JAVA_TOOL_OPTIONS and the value -Dfile.encoding=UTF-8 You might be better restarting after doing that too. Fingers crossed that might help - remove it if not.

2 Likes

i did but processing was not launching anymore:

I’ve deleted the variable and it launches again

Weird! Are you sure you’ve got the right values in there - can you screenshot your environment variables table?

Just tried it on my Windows test machine, with Processing 3.4, and it’s working fine and picks up the right value - testing with this one liner

print(System.getProperty("file.encoding"));

@neilcsmith MY BAD, I had copy " Dfile.encoding=UTF-8" instead of “-Dfile.encoding=UTF-8”. I’ve just corrected and it works!!!

Thanks mate!!
image

Build folder: C:\Users\Tiago\AppData\Local\Temp\android5221860165493195587sketch
:app:preBuild UP-TO-DATE
:app:preDebugBuild
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:checkDebugManifest
:app:generateDebugBuildConfig
:app:prepareLintJar
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:createDebugCompatibleScreenManifests
:app:processDebugManifest
:app:splitsDiscoveryTaskDebug
:app:processDebugResources
:app:generateDebugSources
:app:javaPreCompileDebug
:app:compileDebugJavaWithJavacPicked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

:app:compileDebugNdk NO-SOURCE
:app:compileDebugSources
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:extractTryWithResourcesSupportJarDebug
:app:transformClassesWithStackFramesFixerForDebug
:app:transformClassesWithDesugarForDebugPicked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

:app:transformClassesWithDexBuilderForDebug
:app:transformDexArchiveWithExternalLibsDexMergerForDebug
:app:transformDexArchiveWithDexMergerForDebug
:app:mergeDebugJniLibFolders
:app:transformNativeLibsWithMergeJniLibsForDebug
:app:processDebugJavaRes NO-SOURCE
:app:transformResourcesWithMergeJavaResForDebug
:app:validateSigningDebug
:app:packageDebug
:app:assembleDebug

BUILD SUCCESSFUL in 42s
28 actionable tasks: 28 executed
élève

Thanks all others aswell for the help!!