java - unable to retrieve Unicode data correctly from GUI -
i sending out unicode messages pc phone using jsms api. when use part of code, works perfectly. message displaying "ఈ ఒక తెలుగు సందేశం" perfectly.
smsmessage msg = new smsmessage(); msg.setrecipient("+919561356345"); string unicodemsg = "ఈ ఒక తెలుగు సందేశం"; //telugu script msg.setuserdata(unicodemsg.getbytes("utf-16be")); msg.setcodinggroup(smsmessage.dc_group_general); msg.setalphabet(smsmessage.dc_ucs2); msg.setmessageclass(smsmessage.no_class); service.init(props); service.connect(); service.sendmessage(msg); system.out.println("message sent successfuly, "+msg.getmessage()); service.disconnect(); now in code, if retrieve same message content database swing textarea , extract here, receive blank message on phone. there problem conversion , all? code:
// here argument text tamessage.gettext() tamessage textarea; public sendunicodemessage(string port, string text, object no){ smsmessage msg = new smsmessage(); string num = no.tostring(); msg.setrecipient(num); string unicodemsg = text.tostring ; msg.setuserdata(unicodemsg.getbytes("utf-16be")); msg.setcodinggroup(smsmessage.dc_group_general); msg.setalphabet(smsmessage.dc_ucs2); msg.setmessageclass(smsmessage.no_class); service.init(props); service.connect(); service.sendmessage(msg); system.out.println("message sent successfuly, "+msg.getmessage()); service.disconnect();
you main problem computers can't magically paint characters on screen. not need font, need font contains characters want display. 1 clue problem small, empty rectangle instead of character need. if see that, font useless.
so first thing have find font can display text. next, need install font everywhere need it. means install on phone. instructions of phone's os find out how that.
do not confuse problem seeing ?. rectangle means "valid character font can't display it". question mark in output means somewhere in whole process, en-/decoding got corrupted. happens, example, when output utf-8 on 1 side , read utf-16 on other side.
Comments
Post a Comment