Patch #670715: Universal Unicode Codec for POSIX iconv.
diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py
index 66bea5c..5e4167b 100644
--- a/Lib/encodings/__init__.py
+++ b/Lib/encodings/__init__.py
@@ -120,3 +120,9 @@
 
 # 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
diff --git a/Lib/encodings/iconv_codec.py b/Lib/encodings/iconv_codec.py
new file mode 100644
index 0000000..8bd0c3f
--- /dev/null
+++ b/Lib/encodings/iconv_codec.py
@@ -0,0 +1,34 @@
+""" 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
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 433c939..c433c8b 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -556,6 +556,7 @@
         test_gdbm
         test_gl
         test_grp
+        test_iconv_codec
         test_imgfile
         test_largefile
         test_linuxaudiodev
@@ -611,6 +612,7 @@
         test_fork1
         test_gl
         test_grp
+        test_iconv_codec
         test_imgfile
         test_largefile
         test_linuxaudiodev
@@ -898,6 +900,7 @@
         test_dl
         test_email_codecs
         test_gl
+        test_iconv_codec
         test_imgfile
         test_largefile
         test_linuxaudiodev