Turkish characters are not shown on TextView

2019-09-02 08:41发布

问题:

Turkish characters are not shown on TextView. I have read previous questions and did some changes and they are not solved my problem. Here is picture:

Here is my changed code:

holder.txtGazeteName.setText(Html.fromHtml(gazetelerArrayList.get(position).getName()).toString());

here is input for ArrayList

gazete = new GazetelerClass();
        gazete.setName("YeniŞafak");
        gazete.setAdress("http://www.yenisafak.com.tr/yazarlar/");
        gazete.setImage(R.drawable.yenisafak);
        gazetelerArrayList.add(gazete);

回答1:

I solved my problem. Here is solution:

in build.gradle(module:app) added this code:

compileOptions.encoding = 'windows-1254'

here is build gradle file

apply plugin: 'com.android.application'

android {

    compileSdkVersion 22
    buildToolsVersion "21.1.2"
    compileOptions.encoding = 'windows-1254'
    defaultConfig {
        applicationId "yazlm.beyaz.keyazarlar"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'

}


回答2:

I think this thread should do the trick for you. I remembered having a similar kind of problem. Android. WebView and loadData