HPlus: convert text to either GB2312 or UTF-8

master
João Paulo Barraca 2017-04-12 14:29:24 +01:00
parent c93e97f10f
commit 6ed40a21c6
1 changed files with 4 additions and 1 deletions

View File

@ -800,7 +800,10 @@ public class HPlusSupport extends AbstractBTLEDeviceSupport {
cs = new byte[]{HPlusConstants.transliterateMap.get(c)};
} else {
try {
cs = c.toString().getBytes("GB2312");
if (HPlusCoordinator.getLanguage(this.gbDevice.getAddress()) == HPlusConstants.ARG_LANGUAGE_CN)
cs = c.toString().getBytes("GB2312");
else
cs = c.toString().getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
//Fallback. Result string may be strange, but better than nothing
cs = c.toString().getBytes();