There are two ways of escaping some Unicode characters: \\u and \\x.
For output, the quoted form prefers \\x and the portray form prefers \\u:
X = '\x2', Y = '\u0002',
atom_codes(X, Codes), atom_chars(X, Chars),
format('quoted(~q) canonical(~k) atom(~a) print(~p)~n', [X, X, X, X]).
quoted('\x2\') canonical('\x2\') atom() print('\u0002')
X = Y, Y = '\u0002',
Codes = [2],
Chars = ['\u0002'].
Is there a reason for quoted output preferring the \\x form and portray preferring the \\u form?
From reading the section of the manual on character escape sequences, I infer that the '\u` form isn’t in the ISO standard.
Also, I don’t understand the sentence “where \x defines a numeric character code, it doesn’t specify the character set in which the character should be interpreted” … what character set is being referred to, and how does the '\u` notation fix this problem?