【问题标题】:Android Studio - Illegal character 8204 errorAndroid Studio - 非法字符 8204 错误
【发布时间】:2015-08-23 11:36:48
【问题描述】:

由于某种原因,在重建我的项目后,我收到了一个非法字符错误,但我的代码中没有任何内容带有红色下划线。谁能告诉我哪里出了问题以及如何解决?

错误

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();
        }
    }
}

【问题讨论】:

  • 如何在 Mac 上完成?

标签: java android android-intent android-fragments android-studio


【解决方案1】:

尝试改变你的编码,看图:

【讨论】:

  • 应该选择什么?我目前正在使用UTF-8
【解决方案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.

【讨论】:

  • 请不要发帖duplicate answers。相反,请考虑其他可以帮助未来用户找到所需答案的操作,如链接帖子中所述。
猜你喜欢
  • 2016-04-07
  • 1970-01-01
  • 2019-05-24
  • 2015-05-09
  • 2015-08-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多