| 113 | | * ``smart_unicode(s, encoding='utf-8', errors='strict')`` converts its |
|---|
| 114 | | input to a Unicode string. The ``encoding`` parameter specifies the input |
|---|
| 115 | | encoding. (For example, Django uses this internally when processing form |
|---|
| 116 | | input data, which might not be UTF-8 encoded.) The ``errors`` parameter |
|---|
| 117 | | takes any of the values that are accepted by Python's ``unicode()`` |
|---|
| 118 | | function for its error handling. |
|---|
| | 113 | * ``smart_unicode(s, encoding='utf-8', strings_only=False, errors='strict')`` |
|---|
| | 114 | converts its input to a Unicode string. The ``encoding`` parameter |
|---|
| | 115 | specifies the input encoding. (For example, Django uses this internally |
|---|
| | 116 | when processing form input data, which might not be UTF-8 encoded.) The |
|---|
| | 117 | ``strings_only`` parameter, if set to True, will result in Python |
|---|
| | 118 | numbers, booleans and ``None`` not being converted to a string (they keep |
|---|
| | 119 | their original types). The ``errors`` parameter takes any of the values |
|---|
| | 120 | that are accepted by Python's ``unicode()`` function for its error |
|---|
| | 121 | handling. |
|---|
| 123 | | * ``force_unicode(s, encoding='utf-8', errors='strict')`` is identical to |
|---|
| 124 | | ``smart_unicode()`` in almost all cases. The difference is when the |
|---|
| 125 | | first argument is a `lazy translation`_ instance. While |
|---|
| | 126 | * ``force_unicode(s, encoding='utf-8', strings_only=False, errors='strict')`` |
|---|
| | 127 | is identical to ``smart_unicode()`` in almost all cases. The difference |
|---|
| | 128 | is when the first argument is a `lazy translation`_ instance. While |
|---|
| 135 | | argument to a bytestring. The ``strings_only`` parameter, if set to True, |
|---|
| 136 | | will result in Python integers, booleans and ``None`` not being |
|---|
| 137 | | converted to a string (they keep their original types). This is slightly |
|---|
| 138 | | different semantics from Python's builtin ``str()`` function, but the |
|---|
| 139 | | difference is needed in a few places within Django's internals. |
|---|
| | 138 | argument to a bytestring. The ``strings_only`` parameter has the same |
|---|
| | 139 | behaviour as for ``smart_unicode()`` and ``force_unicode()``. This is |
|---|
| | 140 | slightly different semantics from Python's builtin ``str()`` function, |
|---|
| | 141 | but the difference is needed in a few places within Django's internals. |
|---|