summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Add an optional size argument to _Py_char2wchar()Victor Stinner2010-10-161-2/+3
| | | | | | _Py_char2wchar() callers usually need the result size in characters. Since it's trivial to compute it in _Py_char2wchar() (O(1) whereas wcslen() is O(n)), add an option to get it.
* Use locale encoding if Py_FileSystemDefaultEncoding is not setVictor Stinner2010-10-151-8/+32
| | | | | | | | * PyUnicode_EncodeFSDefault(), PyUnicode_DecodeFSDefaultAndSize() and PyUnicode_DecodeFSDefault() use the locale encoding instead of UTF-8 if Py_FileSystemDefaultEncoding is NULL * redecode_filenames() functions and _Py_code_object_list (issue #9630) are no more needed: remove them
* #9418: first step of moving private string methods to _string module.Georg Brandl2010-10-141-2/+30
|
* PyUnicode_AsWideCharString() takes a PyObject*, not a PyUnicodeObject*Victor Stinner2010-10-071-3/+3
| | | | | All unicode functions uses PyObject* except PyUnicode_AsWideChar(). Fix the prototype for the new function PyUnicode_AsWideCharString().
* Issue #8670: PyUnicode_AsWideChar() and PyUnicode_AsWideCharString() replaceVictor Stinner2010-10-021-22/+105
| | | | | UTF-16 surrogate pairs by single non-BMP characters for 16 bits Py_UNICODE and 32 bits wchar_t (eg. Linux in narrow build).
* Issue #8870: PyUnicode_AsWideCharString() doesn't count the trailing nul ↵Victor Stinner2010-10-021-1/+1
| | | | | | character And write unit tests for PyUnicode_AsWideChar() and PyUnicode_AsWideCharString().
* Fix PyUnicode_AsWideCharString(): set *size if size is not NULLVictor Stinner2010-09-291-0/+2
|
* Issue #9630: Redecode filenames when setting the filesystem encodingVictor Stinner2010-09-291-1/+7
| | | | | | | | | | | | | | Redecode the filenames of: - all modules: __file__ and __path__ attributes - all code objects: co_filename attribute - sys.path - sys.meta_path - sys.executable - sys.path_importer_cache (keys) Keep weak references to all code objects until initfsencoding() is called, to be able to redecode co_filename attribute of all code objects.
* Issue #9979: Create function PyUnicode_AsWideCharString().Victor Stinner2010-09-291-14/+48
|
* use return NULL; it's just as correctBenjamin Peterson2010-09-121-1/+1
|
* Issue #9738, #9836: Fix refleak introduced by r84704Victor Stinner2010-09-121-2/+2
|
* detect non-ascii characters much earlier (plugs ref leak)Benjamin Peterson2010-09-121-7/+7
|
* Issue #9738: PyUnicode_FromFormat() and PyErr_Format() raise an error onVictor Stinner2010-09-111-1/+9
| | | | | | a non-ASCII byte in the format string. Document also the encoding.
* Rename PyUnicode_strdup() to PyUnicode_AsUnicodeCopy()Victor Stinner2010-09-031-1/+1
|
* Create PyUnicode_strdup() functionVictor Stinner2010-09-011-0/+22
|
* Create Py_UNICODE_strcat() functionVictor Stinner2010-09-011-0/+9
|
* Remove unicode_default_encoding constantVictor Stinner2010-09-011-10/+1
| | | | | Inline its value in PyUnicode_GetDefaultEncoding(). The comment is now outdated (we will not change its value anymore).
* Issue #9549: sys.setdefaultencoding() and PyUnicode_SetDefaultEncoding()Antoine Pitrou2010-09-011-11/+0
| | | | | are now removed, since their effect was inexistent in 3.x (the default encoding is hardcoded to utf-8 and cannot be changed).
* Issue #7415: PyUnicode_FromEncodedObject() now uses the new buffer APIAntoine Pitrou2010-09-011-27/+26
| | | | properly. Patch by Stefan Behnel.
* Issue 8781: On systems a signed 4-byte wchar_t and a 4-byte Py_UNICODE, use ↵Daniel Stutzbach2010-08-241-2/+2
| | | | memcpy to convert between the two (as already done when wchar_t is unsigned)
* Fix PyUnicode_EncodeFSDefault() indentationVictor Stinner2010-08-181-2/+2
|
* Issue #9425: Create Py_UNICODE_strncmp() functionVictor Stinner2010-08-161-0/+17
| | | | | The code is based on strncmp() of the libiberty library, function in the public domain.
* Issue #9542: Create PyUnicode_FSDecoder() functionVictor Stinner2010-08-131-3/+41
| | | | | | | | | | | | It's a ParseTuple converter: decode bytes objects to unicode using PyUnicode_DecodeFSDefaultAndSize(); str objects are output as-is. * Don't specify surrogateescape error handler in the comments nor the documentation, but PyUnicode_DecodeFSDefaultAndSize() and PyUnicode_EncodeFSDefault() because these functions use strict error handler for the mbcs encoding (on Windows). * Remove PyUnicode_FSConverter() comment in unicodeobject.c to avoid inconsistency with unicodeobject.h.
* Issue #9425: Create PyErr_WarnFormat() functionVictor Stinner2010-08-131-7/+8
| | | | | | | Similar to PyErr_WarnEx() but use PyUnicode_FromFormatV() to format the warning message. Strip also some trailing spaces.
* Issue #2443: Added a new macro, Py_VA_COPY, which is equivalent to C99Alexander Belopolsky2010-08-111-9/+1
| | | | | va_copy, but available on all python platforms. Untabified a few unrelated files.
* Issue #9425: create Py_UNICODE_strrchr() functionVictor Stinner2010-08-101-0/+13
|
* Revert r83395, it introduces test failures and is not necessary anyway since ↵Georg Brandl2010-08-011-2/+2
| | | | we now have to nul-terminate the string anyway.
* #8821: do not rely on Unicode strings being terminated with a \u0000, rather ↵Georg Brandl2010-08-011-2/+2
| | | | explicitly check range before looking for a second surrogate character.
* Use Py_CLEAR().Georg Brandl2010-07-291-4/+2
|
* Sub-issue of #9036: Fix incorrect use of Py_CHARMASK.Stefan Krah2010-07-191-1/+1
|
* Fix the docstrings of the capitalize method.Senthil Kumaran2010-07-051-1/+1
|
* Update comment about surrogates.Ezio Melotti2010-07-031-5/+5
|
* Update PyUnicode_DecodeUTF8 from RFC 2279 to RFC 3629.Ezio Melotti2010-07-011-56/+56
| | | | | | | | | | | | | 1) #8271: when a byte sequence is invalid, only the start byte and all the valid continuation bytes are now replaced by U+FFFD, instead of replacing the number of bytes specified by the start byte. See http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf (pages 94-95); 2) 5- and 6-bytes-long UTF-8 sequences are now considered invalid (no changes in behavior); 3) Change the error messages "unexpected code byte" to "invalid start byte" and "invalid data" to "invalid continuation byte"; 4) Add an extensive set of tests in test_unicode; 5) Fix test_codeccallbacks because it was failing after this change.
* #9078: fix some Unicode C API descriptions, in comments and docs.Georg Brandl2010-06-271-1/+1
|
* Merged revisions 82248 via svnmerge fromEzio Melotti2010-06-261-1/+1
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r82248 | ezio.melotti | 2010-06-26 21:44:42 +0300 (Sat, 26 Jun 2010) | 1 line Fix extra space. ........
* Issue #850997: mbcs encoding (Windows only) handles errors argument: strictVictor Stinner2010-06-161-38/+125
| | | | | mode raises unicode errors. The encoder only supports "strict" and "replace" error handlers, the decoder only supports "strict" and "ignore" error handlers.
* Silence 'unused variable' gcc warning. Patch by Éric Araujo.Mark Dickinson2010-06-121-1/+2
|
* Issue #8969: On Windows, use mbcs codec in strict mode to encode and decodeVictor Stinner2010-06-111-4/+10
| | | | filenames and enable os.fsencode().
* Merged revisions 81907 via svnmerge fromAntoine Pitrou2010-06-111-19/+21
| | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81907 | antoine.pitrou | 2010-06-11 23:42:26 +0200 (ven., 11 juin 2010) | 5 lines Issue #8941: decoding big endian UTF-32 data in UCS-2 builds could crash the interpreter with characters outside the Basic Multilingual Plane (higher than 0x10000). ........
* Fix r81869: ISO-8859-15 was seen as an alias to ISO-8859-1Victor Stinner2010-06-101-39/+45
| | | | Don't use normalize_encoding() result if it is truncated.
* Issue #8922: Normalize the encoding name in PyUnicode_AsEncodedString() toVictor Stinner2010-06-101-18/+31
| | | | | enable shortcuts for upper case encoding name. Add also a shortcut for "iso-8859-1" in PyUnicode_AsEncodedString() and PyUnicode_Decode().
* Issue #8715: Create PyUnicode_EncodeFSDefault() function: Encode a UnicodeVictor Stinner2010-05-151-3/+13
| | | | | | object to Py_FileSystemDefaultEncoding with the "surrogateescape" error handler, return a bytes object. If Py_FileSystemDefaultEncoding is not set, fall back to UTF-8.
* Enable shortcuts for common encodings in PyUnicode_AsEncodedString() for anyVictor Stinner2010-05-151-23/+31
| | | | error handler, not only the default error handler (strict)
* PyUnicode_DecodeFSDefaultAndSize() uses surrogateescape error handlerVictor Stinner2010-04-301-4/+4
| | | | | | This function is only used to decode Python module filenames, but Python doesn't support surrogates in modules filenames yet. So nobody noticed this minor bug.
* Simplify PyUnicode_FSConverter(): remove reference to PyByteArrayVictor Stinner2010-04-301-9/+3
| | | | PyByteArray is no more supported
* condense conditionBenjamin Peterson2010-04-251-4/+1
|
* Fix my previous commit (r80382) for wide build (unicodeobject.c)Victor Stinner2010-04-221-2/+3
|
* Issue #8092: Fix PyUnicode_EncodeUTF8() to support error handler producingVictor Stinner2010-04-221-47/+80
| | | | unicode string (eg. backslashreplace)
* Issue #8485: PyUnicode_FSConverter() doesn't accept bytearray object anymore,Victor Stinner2010-04-221-1/+1
| | | | you have to convert your bytearray filenames to bytes
* Merged revisions 79494,79496 via svnmerge fromFlorent Xicluna2010-03-301-3/+5
| | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r79494 | florent.xicluna | 2010-03-30 10:24:06 +0200 (mar, 30 mar 2010) | 2 lines #7643: Unicode codepoints VT (0x0B) and FF (0x0C) are linebreaks according to Unicode Standard Annex #14. ........ r79496 | florent.xicluna | 2010-03-30 18:29:03 +0200 (mar, 30 mar 2010) | 2 lines Highlight the change of behavior related to r79494. Now VT and FF are linebreaks. ........