Android Studio - 出现非法字符8204错误

7

不知何故,在重新构建我的项目后,我出现了非法字符错误,但是在我的代码中没有任何文字被用红色下划线标记。请问有人可以告诉我出了什么问题并且如何解决吗?

错误信息

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


在 Mac 上怎么做呢? - wbk727
2个回答

21

尝试更改您的编码方式,如下图所示:

输入图片描述


应该选择什么?我目前正在使用 UTF-8 - natsumiyu

2

这是一个与BOM(字节顺序标记)字符有关的问题。Eclipse不允许出现该字符。

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.

请不要发布重复答案。相反,考虑其他可以帮助未来用户找到所需答案的操作,如链接帖子中所述。 - Mogsdad

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接