当我从光标中提取联系人名字的值时,特殊字符将转换为?:

    if(!d.isNull(CURSOR_FIRST_NAME)){  cm.first = d.getString(CURSOR_FIRST_NAME);}



所以您能帮我找出android通讯录使用哪种编码,以便我可以提取确切的字符串并将其编码为UTF-8吗?


谢谢!

最佳答案

使用URLDecoder.decode()方法:

import java.net.URLDecoder;


    try {
    if(!d.isNull(CURSOR_FIRST_NAME)){cm.first = URLDecoder.decode(d.getString(CURSOR_FIRST_NAME, "UTF-8");}
    } catch (UnsupportedEncodingException e) {
    Log.("UnsupportedEncodingException ", e.getMessage());
    }

10-04 19:04