Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

Python 2 is no longer supported by the community. We recommend that you migrate Python 2 apps to Python 3. module


Utility methods related to Unicode.


Replaces 32-bit Unicode characters with surrogate pairs.

Returns a version of the string argument with all Unicode characters above 0xFFFF (those from the Supplementary Plane) replaced with the appropriate surrogate pairs. If there are no such characters, returns the same string instance.


  • s – a string, possibly of unicode type, to be converted

  • necessary. (if) –


Unicode string with surrogate pairs, or the argument unmodified.