Reputation: 18251
Basically if I do something like
myTextView.setText(jsonObj.getString(USER_NAME));
My text view will show the correct text : あ
if I do the following:
String myText = jsonObj.getString(USER_NAME);
myTextView.setText(myText);
The text also appears correct & shows : あ
In my use case. I have a class RowRecord & constructor & class var
public class RowRecord {
public String mUserName = "";
public RowRecord (JSONObject jsonObj, Context context) {
mUserName = munzee.getString(Constants.MUNZEE_FRIENDLY_NAME);
}
}
I then have my arrayAdapter
public class MyArray extends ArrayAdapter<RowRecord>
When overriding getView
@Override
public View getView(int position, View convertView, ViewGroup parent) {
RowRecord rowRecord = getItem(position);
.
.
.
TextView myUserName = (TextView)itemView.findViewById(R.id.txtUserName);
txtUserName.setText(rowRecord.mUserName);
It ends up displaying like あ
So I went and tried to do the following
String myText= new String( jsonObj.getString(USER_NAME).getBytes(), "UTF-16" );
Unfortunately it displayed it as some square boxes.
I then
Any help would be appreciated, Thanks
Upvotes: 0
Views: 788
Reputation: 52956
Look at the raw JSON string, and make sure strings are in the same encoding your code expects. Your safest bet is to use UTF-8 throughout.
Upvotes: 1