Skip to content

Instantly share code, notes, and snippets.

@apeiros
Created March 26, 2014 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apeiros/9794494 to your computer and use it in GitHub Desktop.
Save apeiros/9794494 to your computer and use it in GitHub Desktop.
Regex, encodings, invalid sequences
# encoding: utf-8
#p(/\xff/.encoding) # -> raises SyntaxError, "invalid multibyte escape: /\xff/"
p(/\xff/n.encoding)
#p(/\xff/u.encoding) # -> raises SyntaxError, "invalid multibyte escape: /\xff/"
p(/x/.encoding)
p(/x/n.encoding)
p(/x/u.encoding)
# encoding: binary
p(/\xff/.encoding)
p(/\xff/n.encoding)
#p(/\xff/u.encoding) # -> raises SyntaxError, "invalid multibyte escape: /\xff/"
p(/x/.encoding)
p(/x/n.encoding)
p(/x/u.encoding)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment