Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 251705 - UnicodeDecodeError pop-up while entering \x code
UnicodeDecodeError pop-up while entering \x code
Product: python
Classification: Unclassified
Component: Editor
PC Windows 8 x64
: P4 (vote)
: 8.1
Assigned To: vincentvdl
Depends on: 251765
  Show dependency treegraph
Reported: 2015-04-07 18:05 UTC by vincentvdl
Modified: 2017-06-27 19:27 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT

Exception UnicodeDecodeError (4.06 KB, text/plain)
2015-04-08 02:23 UTC, Lou Dasaro

Note You need to log in before you can comment on or make changes to this bug.
Description vincentvdl 2015-04-07 18:05:28 UTC
Type the following exactly letter for letter:

test = '\u

while pressing the opening quote (') the editor places the closing ' automatically behind it. While entering the letter "u" a pop-up with an error is raised, so as far as I'm aware you are unable to enter an escaped hex. character sequence without getting this pop-up.

I believe this is a different issue than the other reported UnicodeDecodeError issues.

Exception in popup:

Annotation: Was parsing C:\Users\Vincent\Documents\NetBeansProjects\NewPythonProject3\src\
Annotation: Was parsing C:\Users\Vincent\Documents\NetBeansProjects\NewPythonProject3\src\
Was parsing C:\Users\Vincent\Documents\NetBeansProjects\NewPythonProject3\src\
Was parsing C:\Users\Vincent\Documents\NetBeansProjects\NewPythonProject3\src\
Caused: UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 1-2: truncated \xXX

	at org.python.core.codecs.strict_errors(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.python.core.JavaFunc.__call__(
	at org.python.core.PyObject.__call__(
	at org.python.core.codecs.decoding_error(
	at org.python.core.codecs.insertReplacementAndGetResume(
	at org.python.core.PyString.hexescape(
	at org.python.core.PyString.decode_UnicodeEscape(
	at org.python.antlr.GrammarActions.extractString(
	at org.python.antlr.GrammarActions.extractStrings(
	at org.python.antlr.PythonParser.atom(
	at org.python.antlr.PythonParser.power(
	at org.python.antlr.PythonParser.factor(
	at org.python.antlr.PythonParser.term(
	at org.python.antlr.PythonParser.arith_expr(
	at org.python.antlr.PythonParser.shift_expr(
	at org.python.antlr.PythonParser.and_expr(
	at org.python.antlr.PythonParser.xor_expr(
	at org.python.antlr.PythonParser.expr(
	at org.python.antlr.PythonParser.comparison(
	at org.python.antlr.PythonParser.not_test(
	at org.python.antlr.PythonParser.and_test(
	at org.python.antlr.PythonParser.or_test(
	at org.python.antlr.PythonParser.test(
	at org.python.antlr.PythonParser.testlist(
	at org.python.antlr.PythonParser.expr_stmt(
	at org.python.antlr.PythonParser.small_stmt(
	at org.python.antlr.PythonParser.simple_stmt(
	at org.python.antlr.PythonParser.stmt(
	at org.python.antlr.PythonParser.file_input(
[catch] at org.netbeans.modules.python.editor.PythonParser.parse(
	at org.netbeans.modules.python.editor.PythonParser.parse(
	at org.netbeans.modules.parsing.impl.TaskProcessor.callParse(
	at org.netbeans.modules.parsing.impl.SourceCache.getResult(
	at org.netbeans.modules.parsing.impl.TaskProcessor$
	at org.openide.util.lookup.Lookups.executeWith(
	at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(
	at org.netbeans.modules.parsing.impl.TaskProcessor$
	at java.util.concurrent.Executors$
	at org.openide.util.RequestProcessor$
	at org.netbeans.modules.openide.util.GlobalLookup.execute(
	at org.openide.util.lookup.Lookups.executeWith(
	at org.openide.util.RequestProcessor$
Comment 1 Lou Dasaro 2015-04-08 00:27:08 UTC
Hi Vincent,

I'm not seeing any errors while replicating your test. I entered
test = '\u'
character by character and received no errors, using this environment:

Product Version: NetBeans IDE Dev (Build 201504040001)
Java: 1.8.0_31; Java HotSpot(TM) Client VM 25.31-b07
Runtime: Java(TM) SE Runtime Environment 1.8.0_31-b13
System: Windows 8 version 6.2 running on x86; Cp1252; en_US (nb)
Python: Jython 2.5.1

Please make sure you are using a recent DEVELOPMENT version of NetBeans IDE from
AND with Python plugin installed from "Latest Build" update center at
Comment 2 Lou Dasaro 2015-04-08 02:23:29 UTC
Created attachment 153087 [details]
Exception UnicodeDecodeError

UPDATE: Although '\u' produced no anomaly for me, just for sanity sake, I tested '\a' through '\z'
and an Exception (UnicodeDecodeError) occurred, but ONLY for '\x'

Therefore this bug is valid for the case where test = '\x'
Comment 3 vincentvdl 2015-04-08 17:39:11 UTC
Sorry Lou, I should have been much more careful.

It happens both with:



(\u escaping is only recognized on unicode strings, while \x works with any encoding)

Fore more information about valid escape characters in Python 2.x, see
Comment 4 Lou Dasaro 2015-08-18 07:38:05 UTC
The thing is, users are going to type randomly, and good testers will type all sorts of nonsense. They need to be shown errors instead of exceptions...
Comment 5 Jenselme 2017-06-27 19:26:44 UTC
Resolved in:
changeset:   18519:517409415907
bookmark:    main
tag:         tip
user:        Julien Enselme <>
date:        Tue Jun 27 21:26:18 2017 +0200
summary:     #251705: UnicodeDecodeError pop-up while entering \x code

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo