Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9789aefa
Commit
9789aefa
authored
Jan 26, 2003
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #670715: Universal Unicode Codec for POSIX iconv.
parent
afef4eef
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
690 additions
and
0 deletions
+690
-0
Lib/encodings/__init__.py
Lib/encodings/__init__.py
+6
-0
Lib/encodings/iconv_codec.py
Lib/encodings/iconv_codec.py
+34
-0
Lib/test/regrtest.py
Lib/test/regrtest.py
+3
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_iconv_codec.c
Modules/_iconv_codec.c
+626
-0
setup.py
setup.py
+18
-0
No files found.
Lib/encodings/__init__.py
View file @
9789aefa
...
...
@@ -120,3 +120,9 @@ def search_function(encoding):
# Register the search_function in the Python codec registry
codecs
.
register
(
search_function
)
# Register iconv_codec lookup function if available
try
:
import
iconv_codec
except
ImportError
:
pass
Lib/encodings/iconv_codec.py
0 → 100644
View file @
9789aefa
""" Python 'iconv' Codec
Written by Hye-Shik Chang (perky@FreeBSD.org).
Copyright(c) Python Software Foundation, All Rights Reserved. NO WARRANTY.
"""
import
_iconv_codec
import
codecs
def
lookup
(
enc
):
class
IconvCodec
(
_iconv_codec
.
iconvcodec
,
codecs
.
Codec
):
encoding
=
enc
try
:
c
=
IconvCodec
()
class
IconvStreamReader
(
IconvCodec
,
codecs
.
StreamReader
):
__init__
=
codecs
.
StreamReader
.
__init__
class
IconvStreamWriter
(
IconvCodec
,
codecs
.
StreamWriter
):
__init__
=
codecs
.
StreamWriter
.
__init__
return
(
c
.
encode
,
c
.
decode
,
IconvStreamReader
,
IconvStreamWriter
)
except
ValueError
:
return
None
codecs
.
register
(
lookup
)
# ex: ts=8 sts=4 et
Lib/test/regrtest.py
View file @
9789aefa
...
...
@@ -556,6 +556,7 @@ _expectations = {
test_gdbm
test_gl
test_grp
test_iconv_codec
test_imgfile
test_largefile
test_linuxaudiodev
...
...
@@ -611,6 +612,7 @@ _expectations = {
test_fork1
test_gl
test_grp
test_iconv_codec
test_imgfile
test_largefile
test_linuxaudiodev
...
...
@@ -898,6 +900,7 @@ _expectations = {
test_dl
test_email_codecs
test_gl
test_iconv_codec
test_imgfile
test_largefile
test_linuxaudiodev
...
...
Misc/NEWS
View file @
9789aefa
...
...
@@ -26,6 +26,9 @@ Core and builtins
Extension
modules
-----------------
-
A
new
module
_iconv_codec
has
been
added
,
to
expose
the
iconv
(
3
)
library
.
-
os
/
posixmodule
has
grown
the
sysexits
.
h
constants
(
EX_OK
and
friends
).
-
Fixed
broken
threadstate
swap
in
readline
that
could
cause
fatal
...
...
Modules/_iconv_codec.c
0 → 100644
View file @
9789aefa
This diff is collapsed.
Click to expand it.
setup.py
View file @
9789aefa
...
...
@@ -614,6 +614,24 @@ class PyBuildExt(build_ext):
exts
.
append
(
Extension
(
'nis'
,
[
'nismodule.c'
],
libraries
=
libs
)
)
# Hye-Shik Chang's iconv_codec C interface
iconv_incs
=
find_file
(
'iconv.h'
,
inc_dirs
,
[
'/usr/local/include'
,
'/usr/pkg/include'
])
iconv_libs
=
find_library_file
(
self
.
compiler
,
'iconv'
,
lib_dirs
,
[
'/usr/local/lib'
,
'/usr/pkg/lib'
])
if
(
iconv_incs
is
not
None
):
if
iconv_libs
is
not
None
:
iconv_libraries
=
[
'iconv'
]
else
:
iconv_libraries
=
[]
# in libc
exts
.
append
(
Extension
(
'_iconv_codec'
,
[
'_iconv_codec.c'
],
include_dirs
=
iconv_incs
,
library_dirs
=
iconv_libs
,
libraries
=
iconv_libraries
),
)
# Curses support, requring the System V version of curses, often
# provided by the ncurses library.
if
platform
==
'sunos4'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment