Android Studio - Illegal character 8204 error

2019-04-07 12:21发布

For some reason, after rebuilding my project I get an illegal character error but nothing within my code gets underlined in red. Can someone please tell me what is wrong and how to resolve it?

Error

illegal character: \8204

WCBankActivity.java

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBarActivity;

public class WCBankActivity extends ActionBarActivity {

    public final static String EXTRA_MESSAGE = "Station_key";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_wc_bank);

        if (savedInstanceState == null) {
            Intent intent = getIntent();
            String station = intent.getStringExtra(WCBankActivity.EXTRA_MESSAGE);

            FragmentWCBank newFragment = new FragmentWCBank();
            FragmentTransaction transaction = this.getSupportFragmentManager().beginTransaction();‌
            transaction.replace(R.id.detail_container, newFragment);
            transaction.commit();
        }
    }
}

1

2条回答
放我归山
2楼-- · 2019-04-07 12:48

Try changing your encoding, see the image:

enter image description here

查看更多
Summer. ? 凉城
3楼-- · 2019-04-07 12:57

That's a problem related to BOM (Byte Order Mark) character. Eclipse doesn't allow this character.

Just copy paste the same content to a Notepad++ editor,
it shows the "LS" with black background. Have deleted the "LS" content and 
have copy the same content from notepad++ to java file, it works fine.
查看更多
登录 后发表回答