2016年4月27日 星期三

Android Studio build error: illegal character: '\ufeff'

References:

http://nobodycare.me/2014/11/07/android-studiode-common-questions/
http://www.codegur.net/36027875/character-set-issue-utf-8
http://lifelongprogrammer.blogspot.tw/2014/05/powershell-and-java-stumble-by-utf8-bom.html

Scenario:

Import android project from Eclipse to Android Studio.

Error message:

illegal character: '\ufeff'


Root cause:

The invisible prefix is \ufeff. U+FEFF is byte order mark (BOM).
But java uses utf8 without bom to read file.

Solution:

Opened the document in notepad and changed the encoding to UTF-8 to save it.

沒有留言: