120 | | 5) System-strings (like table or field names, attribute names, etc.) should never contain non-ASCII characters, so that they safely pass through str(). |
121 | | |
122 | | 6) In reading XML, we follow the encoding specified in the XML declaration rather than making assumptions about the encoding. For all other sources, we |
| 126 | 6) System-strings (like table or field names, attribute names, etc.) should never contain non-ASCII characters, so that they safely pass through str(). |
| 127 | |
| 128 | 7) In reading XML, we follow the encoding specified in the XML declaration rather than making assumptions about the encoding. For all other sources, we |
125 | | 7) All code is utf-8 encoded, so that all string constants are automatically utf-8 encoded str. We do not use u"..." for string constants. |
126 | | |
127 | | 8) Note that, in Python 2, str.lower() and str.upper() may not work correctly for some unicode characters (e.g. "Ẽ".lower() gives "Ẽ" again - instead of "ẽ"), depending on the server locale setting. To ensure correct behavior, we must convert into unicode first, using s3_unicode: |
128 | | |
129 | | {{{ |
130 | | s_lowercase = s3_unicode(s).lower().encode("utf-8") |
131 | | }}} |
| 131 | 8) All code is utf-8 encoded, so that all string constants are automatically utf-8 encoded str. We do not use u"..." for string constants. |