digitalmars.D.learn - Error: char 0x200b not allowed in identifier
- zoujiaqing (89/89) Jun 03 2019 Error for code:
- ag0aep6g (11/14) Jun 03 2019 U+200B is: ZERO WIDTH SPACE. Somehow you got that invisible character
- zoujiaqing (2/16) Jun 03 2019 Thanks :)
Error for code: source/hunt/xml/Element.d(12,13): Error: char 0x200b not allowed in identifier source/hunt/xml/Element.d(12,23): Error: character 0x200b is not a valid token source/hunt/xml/Element.d(17,15): Error: char 0x200b not allowed in identifier source/hunt/xml/Element.d(17,26): Error: character 0x200b is not a valid token source/hunt/xml/Element.d(22,13): Error: char 0x200b not allowed in identifier source/hunt/xml/Element.d(22,29): Error: character 0x200b is not a valid token source/hunt/xml/Element.d(48,13): Error: char 0x200b not allowed in identifier source/hunt/xml/Element.d(48,21): Error: character 0x200b is not a valid token source/hunt/xml/Element.d(55,13): Error: char 0x200b not allowed in identifier source/hunt/xml/Element.d(55,23): Error: character 0x200b is not a valid token source/hunt/xml/Element.d(62,13): Error: char 0x200b not allowed in identifier source/hunt/xml/Element.d(62,20): Error: character 0x200b is not a valid token The Code file Element.d ```D module hunt.xml.Element; import hunt.xml.ElementType; class Element { this(string name) { this._name = name; } Element addElement(string name) { return new Element(name); } Element[] getElements() { return this._elements; } Element getParentELement() { return this._parentElement; } Element removeAttribute(string key) { this._attributes.remove(key); return this; } Element addAttribute(string key, string value) { this._attributes[key] = value; return this; } Element setAttribute(string key, string value) { this._attributes[key] = value; return this; } Element addCDATA(string cdata) { this._cdata = cdata; return this; } Element addComment(string comment) { this._comments ~= comment; return this; } Element addText(string text) { this._text = text; return this; } private { string _name; Element[] _elements; Element _parentElement; string[string] _attributes; string[] _comments; string _text; string _cdata; } } ```
Jun 03 2019
On 03.06.19 15:37, zoujiaqing wrote:Error for code: source/hunt/xml/Element.d(12,13): Error: char 0x200b not allowed in identifierU+200B is: ZERO WIDTH SPACE. Somehow you got that invisible character into your code. You have to get rid of it. To do it manually, navigate to the locations the compiler gives you and find the spot where the cursor seems to get stuck for one key press. That's where a zero width space is. You can also open the file in a different non-Unicode encoding. The zero width spaces should stick out as non-ASCII symbols. Or you could write a program that goes over the file and filters the zero width spaces out. Or just re-write whole lines or the whole file by hand.
Jun 03 2019
On Monday, 3 June 2019 at 14:41:18 UTC, ag0aep6g wrote:On 03.06.19 15:37, zoujiaqing wrote:Thanks :)Error for code: source/hunt/xml/Element.d(12,13): Error: char 0x200b not allowed in identifierU+200B is: ZERO WIDTH SPACE. Somehow you got that invisible character into your code. You have to get rid of it. To do it manually, navigate to the locations the compiler gives you and find the spot where the cursor seems to get stuck for one key press. That's where a zero width space is. You can also open the file in a different non-Unicode encoding. The zero width spaces should stick out as non-ASCII symbols. Or you could write a program that goes over the file and filters the zero width spaces out. Or just re-write whole lines or the whole file by hand.
Jun 03 2019