utf8
Module¶
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Created by Vladyslav Kozlovskyy (Ukraine) <dbdevelop©gmail.com>
for Web2py project
Utilities and class for UTF8 strings managing¶
-
class
gluon.utf8.
Utf8
[source]¶ Bases:
str
Class for utf8 string storing and manipulations
The base presupposition of this class usage is: “ALL strings in the application are either of utf-8 or unicode type, even when simple str type is used. UTF-8 is only a “packed” version of unicode, so Utf-8 and unicode strings are interchangeable.”
CAUTION! This class is slower than str/unicode! Do NOT use it inside intensive loops. Simply decode string(s) to unicode before loop and encode it back to utf-8 string(s) after intensive calculation.
You can see the benefit of this class in doctests() below