Re: Knowing the length(convert(username using windows_1251_to_utf8))

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Knowing the length(convert(username using windows_1251_to_utf8))
Date: 2007-01-11 13:48:06
Message-ID: 20070111134806.GD5836@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 11, 2007 at 12:37:32PM +0100, Alexander Farber wrote:
> May I ask you an off-topic question? I've read several
> docs on Unicode, but they are difficult to understand.

Have you read the Unicode FAQ?

http://www.cl.cam.ac.uk/~mgk25/unicode.html

> Do you think that an UTF8 string will ever have a 0 byte
> inside of it? Or is it safe to continue using strlen/strlcpy/strcmp
> on the UTF8 values I'll be fetching from my database?

The answer to your questions are no and yes respectivly. See the FAQ.
That is also one of the reasons why Linux/Unix went for utf-8, because
it required minimal changes to programs (and in particular, the C
library).

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adam Rich 2007-01-11 14:03:48 Re: Optimize expresiions.
Previous Message han.holl 2007-01-11 12:47:17 Re: Optimize expresiions.