Cannot use \uXXXX to replicated JavaScript behaviour

Somehow the SWI-Prolog \uXXXX character syntax doesn’t understand
surrogate pairs. So its difficult to replicate JavaScript stuff:


SWI-Prolog already barks when I try to enter a query:

?- X = '\uD83D\uDE02', atom_codes(X, L).
ERROR: Syntax error: Illegal character code