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

Inconsistent character encoding for serial.write() #75

Open
tkem opened this issue Dec 15, 2016 · 2 comments
Open

Inconsistent character encoding for serial.write() #75

tkem opened this issue Dec 15, 2016 · 2 comments

Comments

@tkem
Copy link
Contributor

tkem commented Dec 15, 2016

I noticed that the native writeSerial() on Android
https://github.com/xseignard/cordovarduino/blob/master/src/android/fr/drangies/cordova/serial/Serial.java#L284
uses getBytes(), which "encodes the string using the platform's default charset", which seems to always be UTF-8 on Android
https://developer.android.com/reference/java/nio/charset/Charset.html
while on Ubuntu the string argument is explicitly converted to Latin-1:
https://github.com/xseignard/cordovarduino/blob/master/src/ubuntu/serial.cpp#L94

AFAICS, cordovarduino's documentation does not state anything about character encodings, or how characters with charCode >= 128 will be handled by serial.write(). However, handling this differently depending on the platform may be surprising to users.

@xseignard
Copy link
Owner

Oh! nice catch! Changing it asap.

@tkem
Copy link
Contributor Author

tkem commented Sep 18, 2017

Great to hear from you again! ;-)

xseignard added a commit that referenced this issue Sep 18, 2017
To be consistent between android and ubuntu.
See #75
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