Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

valueerror: all strings must be xml compatible: unicode or ascii, no null bytes or control characters

def valid_xml_char_ordinal(c):
    codepoint = ord(c)
    # conditions ordered by presumed frequency
    return (
        0x20 <= codepoint <= 0xD7FF or
        codepoint in (0x9, 0xA, 0xD) or
        0xE000 <= codepoint <= 0xFFFD or
        0x10000 <= codepoint <= 0x10FFFF
        )
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #strings #xml #unicode #null #bytes #control #characters
ADD COMMENT
Topic
Name
4+3 =