5

ラテン語で表示する必要のあるテキストがあります。テキストファイルがTextViewに表示されると、疑問符が付いた小さなひし形が、すべての文字にアクセントが付いているはずの場所に表示されます。誰か助けてもらえますか?テキストをそのままPDFで表示できるようにする必要があります。そこで、PDFからテキストファイルにテキストのセクションをコピーして、テキストファイルを取得しました。テキストファイルをスキャンするコードは次のようになります。

public String inputStreamToString(InputStream is) throws IOException
{
    StringBuffer sBuffer = new StringBuffer();
    BufferedReader  dataIO = new BufferedReader(new InputStreamReader (is));
    String strLine = null;
    while ((strLine = dataIO.readLine()) != null)
    {
        sBuffer.append(strLine + "\n");
    }

    dataIO.close();
    is.close();

    return sBuffer.toString();
}

次に、onCreate()にこれがあります:

text = (TextView)findViewById(R.id.textView1);

    //text.setText("This is a whole lot of text and praying");
    InputStream iFile = getResources().openRawResource(idEng);
    try {

        text.setText(inputStreamToString(iFile));
        text.setFocusable(false);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    text.setMovementMethod(new ScrollingMovementMethod());

    ELswitch = (ToggleButton)findViewById(R.id.toggleButton1);
    ELswitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {


        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // TODO Auto-generated method stub
            if(isChecked==true)
            {
                InputStream iFile = getResources().openRawResource(idLat);
                System.out.println(R.raw.sunday_compline_english);
                try {

                    text.setText(inputStreamToString(iFile));
                    text.setFocusable(false);
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            } else {
                InputStream iFile = getResources().openRawResource(idEng);
                try {

                    text.setText(inputStreamToString(iFile));
                    text.setFocusable(false);
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    });

トグルボタンは、ユーザーが英語とラテン語を切り替えることができるようにするためのものです。問題は、ラテン語が次のように表示されることです(アクセント付きのすべての文字が、奇妙な疑問符記号に置き換えられます)。 アクセント付きの文字が表示されない問題

これはテキストファイルの問題ですか?PDFから直接作業する必要がありますか?誰かアイデアがあれば、助けていただければ幸いです。ありがとう!

4

0 に答える 0