pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Space requirements (with respect to foriegn languages)
3+ messages / 2 participants
[nested] [flat]

* Space requirements (with respect to foriegn languages)
@ 2004-08-26 20:36 Gerard Samuel <php-db@trini0.org>
  2004-08-28 14:39 ` Re: Space requirements (with respect to foriegn languages) Markus Bertheau <twanger@bluetwanger.de>
  0 siblings, 1 reply; 3+ messages in thread

From: Gerard Samuel @ 2004-08-26 20:36 UTC (permalink / raw)
  To: pgsql-php

My site/code/database is developed primarily for the english language.
I've had people from "The Far East" add content to my site using their
native language, and it is displaying properly in the site.
But Im a bit concerned about the number of characters these languages use.
For example, I've had someone enter ->
chinese testing 中文

It is saved in the database as ->
chinese testing&#12288;&#20013;&#25991;

Now, forgive my ignorance, but I have no idea what the additional
chinese characters mean, but from the values in the database, Im
assuming that it amounts to 3 characters.
But if Im correct that those are 3 characters, it is
using up 24 characters in a column.

My concern is that what if I were to limit a column to say 25 "english"
characters, and a chinese fellow, comes by and hypothetically says
"Hello World" in chinese and goes over the limit of the column, the data
will be truncated.

Is there anything that can be done to overcome this shortcoming?

Im currently using PostgreSQL 7.4.2, using SQL_ASCII as the database
characterset, FreeBSD 4.10, php 4.3.6.

Thanks for any advise you can provide...





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Space requirements (with respect to foriegn languages)
  2004-08-26 20:36 Space requirements (with respect to foriegn languages) Gerard Samuel <php-db@trini0.org>
@ 2004-08-28 14:39 ` Markus Bertheau <twanger@bluetwanger.de>
  2004-08-28 20:23   ` Re: Space requirements (with respect to foriegn languages) Gerard Samuel <php-db@trini0.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Markus Bertheau @ 2004-08-28 14:39 UTC (permalink / raw)
  To: Gerard Samuel <php-db@trini0.org>; +Cc: pgsql-php

В Чтв, 26.08.2004, в 22:36, Gerard Samuel пишет:
> My site/code/database is developed primarily for the english language.
> I've had people from "The Far East" add content to my site using their
> native language, and it is displaying properly in the site.
> But Im a bit concerned about the number of characters these languages use.
> For example, I've had someone enter ->
> chinese testing 中文
> 
> It is saved in the database as ->
> chinese testing&#12288;&#20013;&#25991;

Your web page uses a character set that does not contain chinese
characters. So the browser decided to send their respective HTML
entities instead. These entities, as you correctly observed, amount to
more than one (latin, ASCII) character.

> Now, forgive my ignorance, but I have no idea what the additional
> chinese characters mean, but from the values in the database, Im
> assuming that it amounts to 3 characters.
> But if Im correct that those are 3 characters, it is
> using up 24 characters in a column.
> 
> My concern is that what if I were to limit a column to say 25 "english"
> characters, and a chinese fellow, comes by and hypothetically says
> "Hello World" in chinese and goes over the limit of the column, the data
> will be truncated.

PostgreSQL will not truncate the data, but reject it; but the general
point is correct.

> Is there anything that can be done to overcome this shortcoming?
> 
> Im currently using PostgreSQL 7.4.2, using SQL_ASCII as the database
> characterset, FreeBSD 4.10, php 4.3.6.

Change your site to use a character set that includes chinese
characters, for example Unicode. The most common encoding of Unicode on
the web is UTF-8. It's also the encoding PostgreSQL uses when you use
UNICODE as the database encoding.

If you decide to switch your site to UTF-8 and want varchar(25) to mean
25 characters, and not 25 bytes, you have to change the database
encoding to UNICODE accordingly.

-- 
Markus Bertheau <twanger@bluetwanger.de>




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Space requirements (with respect to foriegn languages)
  2004-08-26 20:36 Space requirements (with respect to foriegn languages) Gerard Samuel <php-db@trini0.org>
  2004-08-28 14:39 ` Re: Space requirements (with respect to foriegn languages) Markus Bertheau <twanger@bluetwanger.de>
@ 2004-08-28 20:23   ` Gerard Samuel <php-db@trini0.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Gerard Samuel @ 2004-08-28 20:23 UTC (permalink / raw)
  To: Markus Bertheau <twanger@bluetwanger.de>; +Cc: pgsql-php

Markus Bertheau wrote:
> В Чтв, 26.08.2004, в 22:36, Gerard Samuel пишет:
>>Im currently using PostgreSQL 7.4.2, using SQL_ASCII as the database
>>characterset, FreeBSD 4.10, php 4.3.6.
> 
> 
> Change your site to use a character set that includes chinese
> characters, for example Unicode. The most common encoding of Unicode on
> the web is UTF-8. It's also the encoding PostgreSQL uses when you use
> UNICODE as the database encoding.
> 
> If you decide to switch your site to UTF-8 and want varchar(25) to mean
> 25 characters, and not 25 bytes, you have to change the database
> encoding to UNICODE accordingly.
> 

I'll try some mock scripts to see if it will pan out...
Thanks



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-08-28 20:23 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-08-26 20:36 Space requirements (with respect to foriegn languages) Gerard Samuel <php-db@trini0.org>
2004-08-28 14:39 ` Markus Bertheau <twanger@bluetwanger.de>
2004-08-28 20:23   ` Gerard Samuel <php-db@trini0.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox