Skip site navigation (1) Skip section navigation (2)

patch: utf8_to_unicode (trivial)

From: Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: patch: utf8_to_unicode (trivial)
Date: 2010-07-25 02:34:53
Message-ID: AANLkTikXp_V4crhGTUXs_4VSyrMKTMtuufo6zwt5DDBT@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
In src/include/mb/pg_wchar.h , there is a function unicode_to_utf8 ,
but no corresponding utf8_to_unicode .  However, there is a static
function called utf2ucs that does what utf8_to_unicode would do.

I'd like this function to be available because the JSON code needs to
convert UTF-8 to and from Unicode codepoints, and I'm currently using
a separate UTF-8 to codepoint function for that.

This patch renames utf2ucs to utf8_to_unicode and makes it public.  It
also fixes the version of utf2ucs in  src/bin/psql/mbprint.c so that
it's equivalent to the one in wchar.c .

This is a patch against CVS HEAD for application.  It compiles and
tests successfully.

Comments?  Thanks,


Joey Adams

Attachment: utf8-to-unicode.patch
Description: application/octet-stream (3.5 KB)

Responses

pgsql-hackers by date

Next:From: Massa, Harald ArminDate: 2010-07-25 06:06:56
Subject: Re: patch: Add JSON datatype to PostgreSQL (GSoC, WIP)
Previous:From: James William PyeDate: 2010-07-25 02:03:20
Subject: Re: [HACKERS] Trouble with COPY IN

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group