[vlc-commits] Treat UTF-16 as UCS-2 on OS/2

KO Myung-Hun git at videolan.org
Sat Mar 24 16:58:15 CET 2012


vlc/vlc-2.0 | branch: master | KO Myung-Hun <komh78 at gmail.com> | Fri Mar  2 23:58:01 2012 +0900| [e8630fd474a89447465b61dfd837bea5036588f5] | committer: Rémi Denis-Courmont

Treat UTF-16 as UCS-2 on OS/2

OS/2 supports UCS-2 only instead of UTF-16.

Signed-off-by: Rafaël Carré <funman at videolan.org>
(cherry picked from commit 2cc70e681e8c5aab68679180f03eaf60cc8ded38)

Signed-off-by: KO Myung-Hun <komh at chollian.net>
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=e8630fd474a89447465b61dfd837bea5036588f5
---

 src/extras/libc.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/extras/libc.c b/src/extras/libc.c
index 6df1a52..08b19fc 100644
--- a/src/extras/libc.c
+++ b/src/extras/libc.c
@@ -326,6 +326,23 @@ vlc_iconv_t vlc_iconv_open( const char *tocode, const char *fromcode )
         return (vlc_iconv_t)(-2);
 #endif
 #if defined(HAVE_ICONV)
+# if defined(__OS2__) && defined(__INNOTEK_LIBC__)
+    char tocode_ucs2[] = "UCS-2LE";
+    char fromcode_ucs2[] = "UCS-2LE";
+
+    /* Workaround for UTF-16 because OS/2 supports UCS-2 only not UTF-16 */
+    if( !strncmp( tocode, "UTF-16", 6 ))
+    {
+        strncpy( tocode_ucs2 + 5, tocode + 6, 2 );
+        tocode = tocode_ucs2;
+    }
+
+    if( !strncmp( fromcode, "UTF-16", 6 ))
+    {
+        strncpy( fromcode_ucs2 + 5, fromcode + 6, 2 );
+        fromcode = fromcode_ucs2;
+    }
+# endif
     return iconv_open( tocode, fromcode );
 #else
     return (vlc_iconv_t)(-1);



More information about the vlc-commits mailing list