Python pygments.util._surrogatepair() Examples
The following are 9
code examples of pygments.util._surrogatepair().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pygments.util
, or try the search function
.
Example #1
Source File: rtf.py From pigaios with GNU General Public License v3.0 | 6 votes |
def _escape_text(self, text): # empty strings, should give a small performance improvment if not text: return u'' # escape text text = self._escape(text) buf = [] for c in text: cn = ord(c) if cn < (2**7): # ASCII character buf.append(str(c)) elif (2**7) <= cn < (2**16): # single unicode escape sequence buf.append(u'{\\u%d}' % cn) elif (2**16) <= cn: # RTF limits unicode to 16 bits. # Force surrogate pairs buf.append(u'{\\u%d}{\\u%d}' % _surrogatepair(cn)) return u''.join(buf).replace(u'\n', u'\\par\n')
Example #2
Source File: rtf.py From pySINDy with MIT License | 6 votes |
def _escape_text(self, text): # empty strings, should give a small performance improvment if not text: return u'' # escape text text = self._escape(text) buf = [] for c in text: cn = ord(c) if cn < (2**7): # ASCII character buf.append(str(c)) elif (2**7) <= cn < (2**16): # single unicode escape sequence buf.append(u'{\\u%d}' % cn) elif (2**16) <= cn: # RTF limits unicode to 16 bits. # Force surrogate pairs buf.append(u'{\\u%d}{\\u%d}' % _surrogatepair(cn)) return u''.join(buf).replace(u'\n', u'\\par\n')
Example #3
Source File: rtf.py From pygments with BSD 2-Clause "Simplified" License | 6 votes |
def _escape_text(self, text): # empty strings, should give a small performance improvement if not text: return u'' # escape text text = self._escape(text) buf = [] for c in text: cn = ord(c) if cn < (2**7): # ASCII character buf.append(str(c)) elif (2**7) <= cn < (2**16): # single unicode escape sequence buf.append(u'{\\u%d}' % cn) elif (2**16) <= cn: # RTF limits unicode to 16 bits. # Force surrogate pairs buf.append(u'{\\u%d}{\\u%d}' % _surrogatepair(cn)) return u''.join(buf).replace(u'\n', u'\\par\n')
Example #4
Source File: rtf.py From komodo-wakatime with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _escape_text(self, text): # empty strings, should give a small performance improvment if not text: return u'' # escape text text = self._escape(text) buf = [] for c in text: cn = ord(c) if cn < (2**7): # ASCII character buf.append(str(c)) elif (2**7) <= cn < (2**16): # single unicode escape sequence buf.append(u'{\\u%d}' % cn) elif (2**16) <= cn: # RTF limits unicode to 16 bits. # Force surrogate pairs buf.append(u'{\\u%d}{\\u%d}' % _surrogatepair(cn)) return u''.join(buf).replace(u'\n', u'\\par\n')
Example #5
Source File: rtf.py From Carnets with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _escape_text(self, text): # empty strings, should give a small performance improvment if not text: return u'' # escape text text = self._escape(text) buf = [] for c in text: cn = ord(c) if cn < (2**7): # ASCII character buf.append(str(c)) elif (2**7) <= cn < (2**16): # single unicode escape sequence buf.append(u'{\\u%d}' % cn) elif (2**16) <= cn: # RTF limits unicode to 16 bits. # Force surrogate pairs buf.append(u'{\\u%d}{\\u%d}' % _surrogatepair(cn)) return u''.join(buf).replace(u'\n', u'\\par\n')
Example #6
Source File: rtf.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 6 votes |
def _escape_text(self, text): # empty strings, should give a small performance improvement if not text: return u'' # escape text text = self._escape(text) buf = [] for c in text: cn = ord(c) if cn < (2**7): # ASCII character buf.append(str(c)) elif (2**7) <= cn < (2**16): # single unicode escape sequence buf.append(u'{\\u%d}' % cn) elif (2**16) <= cn: # RTF limits unicode to 16 bits. # Force surrogate pairs buf.append(u'{\\u%d}{\\u%d}' % _surrogatepair(cn)) return u''.join(buf).replace(u'\n', u'\\par\n')
Example #7
Source File: rtf.py From diaphora with GNU Affero General Public License v3.0 | 6 votes |
def _escape_text(self, text): # empty strings, should give a small performance improvment if not text: return u'' # escape text text = self._escape(text) buf = [] for c in text: cn = ord(c) if cn < (2**7): # ASCII character buf.append(str(c)) elif (2**7) <= cn < (2**16): # single unicode escape sequence buf.append(u'{\\u%d}' % cn) elif (2**16) <= cn: # RTF limits unicode to 16 bits. # Force surrogate pairs buf.append(u'{\\u%d}{\\u%d}' % _surrogatepair(cn)) return u''.join(buf).replace(u'\n', u'\\par\n')
Example #8
Source File: rtf.py From android_universal with MIT License | 6 votes |
def _escape_text(self, text): # empty strings, should give a small performance improvment if not text: return u'' # escape text text = self._escape(text) buf = [] for c in text: cn = ord(c) if cn < (2**7): # ASCII character buf.append(str(c)) elif (2**7) <= cn < (2**16): # single unicode escape sequence buf.append(u'{\\u%d}' % cn) elif (2**16) <= cn: # RTF limits unicode to 16 bits. # Force surrogate pairs buf.append(u'{\\u%d}{\\u%d}' % _surrogatepair(cn)) return u''.join(buf).replace(u'\n', u'\\par\n')
Example #9
Source File: rtf.py From syntax-highlighting with GNU Affero General Public License v3.0 | 6 votes |
def _escape_text(self, text): # empty strings, should give a small performance improvment if not text: return u'' # escape text text = self._escape(text) buf = [] for c in text: cn = ord(c) if cn < (2**7): # ASCII character buf.append(str(c)) elif (2**7) <= cn < (2**16): # single unicode escape sequence buf.append(u'{\\u%d}' % cn) elif (2**16) <= cn: # RTF limits unicode to 16 bits. # Force surrogate pairs buf.append(u'{\\u%d}{\\u%d}' % _surrogatepair(cn)) return u''.join(buf).replace(u'\n', u'\\par\n')