pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Question regarding multibyte.
5+ messages / 4 participants
[nested] [flat]

* Question regarding multibyte.
@ 2007-02-02 19:51  Karthikeyan Sundaram <skarthi98@hotmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Karthikeyan Sundaram @ 2007-02-02 19:51 UTC (permalink / raw)
  To: pgsql-sql

Hi,

   I am new to postgres.  We are using 8.2 release of postgres.  Recently we 
converted our database to multibyte on our dev machine. we want to test the 
following.

    1) How will I insert multibyte from our php?  Do we need to use any 
special encoding?
    2) I am using psql command line to get the data into a flat file and 
push to our data warehouse
        We use IBM redbrick warehouse.
    3) If I have multibyte, I know the output from the psql will scatter to 
many lines.  How can we avoid that.  What is the sql command ? I need 1 
record per row to supply to our warehouse.

     Can somebody help me?

Regards
skarthi

_________________________________________________________________
Valentine’s Day -- Shop for gifts that spell L-O-V-E at MSN Shopping 
http://shopping.msn.com/content/shp/?ctId=8323,ptnrid=37,ptnrdata=24095&tcode=wlmtagline




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

* Re: [SQL] Question regarding multibyte.
@ 2007-02-04 21:34  Karthikeyan Sundaram <skarthi98@hotmail.com>
  parent: Karthikeyan Sundaram <skarthi98@hotmail.com>
  0 siblings, 3 replies; 5+ messages in thread

From: Karthikeyan Sundaram @ 2007-02-04 21:34 UTC (permalink / raw)
  To: pgsql-sql; +Cc: pgsql-php@postgresql.org; pgsql-admin@postgresql.org

Hi,

   I am new to postgres.  I asked a question regarding multibyte display.  I 
got only one response.
Hence, I am re-iterating the question again to a larger audience.

We are using 8.2 release of postgres.  Recently we converted our database to 
multibyte on our dev machine. we want to test the following.

   1) How will I insert multibyte from our php?  Do we need to use any 
special encoding?
   2) I am using psql command line to get the data into a flat file and push 
to our data warehouse
       We use IBM redbrick warehouse.
   3) If I have multibyte, I know the output from the psql will scatter to 
many lines.  How can we avoid that.  What is the sql command ? I need 1 
record per row to supply to our warehouse.

    Can somebody help me?

Regards
skarthi

_________________________________________________________________
Valentine’s Day -- Shop for gifts that spell L-O-V-E at MSN Shopping 
http://shopping.msn.com/content/shp/?ctId=8323,ptnrid=37,ptnrdata=24095&tcode=wlmtagline




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

* Re: [PHP] [SQL] Question regarding multibyte.
@ 2007-02-04 22:30  Michael Fuhr <mike@fuhr.org>
  parent: Karthikeyan Sundaram <skarthi98@hotmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Michael Fuhr @ 2007-02-04 22:30 UTC (permalink / raw)
  To: Karthikeyan Sundaram <skarthi98@hotmail.com>; +Cc: pgsql-sql; pgsql-php@postgresql.org; pgsql-admin@postgresql.org

On Sun, Feb 04, 2007 at 01:34:41PM -0800, Karthikeyan Sundaram wrote:
>   I am new to postgres.  I asked a question regarding multibyte display.  I 
> got only one response.
> Hence, I am re-iterating the question again to a larger audience.

pgsql-general would probably be the largest audience; maybe somebody
with access to list statistics can confirm or correct.

I responded to your original message in pgsql-admin; maybe you
haven't seen the response yet:

http://archives.postgresql.org/pgsql-admin/2007-02/msg00043.php

If the comments aren't helpful then please provide more information
about the difficulties you're having.  A minimal but complete example
that illustrates the problem might be useful.

-- 
Michael Fuhr



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

* Re: [SQL] Question regarding multibyte.
@ 2007-02-04 22:44  Charley Tiggs <lists@tiggs.net>
  parent: Karthikeyan Sundaram <skarthi98@hotmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Charley Tiggs @ 2007-02-04 22:44 UTC (permalink / raw)
  To: Karthikeyan Sundaram <skarthi98@hotmail.com>; +Cc: pgsql-php@postgresql.org

Karthikeyan Sundaram wrote:
> Hi,
> 
>   I am new to postgres.  I asked a question regarding multibyte 
> display.  I got only one response.
> Hence, I am re-iterating the question again to a larger audience.
> 
> We are using 8.2 release of postgres.  Recently we converted our 
> database to multibyte on our dev machine. we want to test the following.
> 
>   1) How will I insert multibyte from our php?  Do we need to use any 
> special encoding?
>   2) I am using psql command line to get the data into a flat file and 
> push to our data warehouse
>       We use IBM redbrick warehouse.
>   3) If I have multibyte, I know the output from the psql will scatter 
> to many lines.  How can we avoid that.  What is the sql command ? I need 
> 1 record per row to supply to our warehouse.
> 
>    Can somebody help me?
> 
> Regards
> skarthi

http://www.php.net/mbstring
http://www.php.net/iconv

Those are the two pages that will give you more information about your 
needs.  But these aren't the only factors when sending data collected 
via php to postgres.  There's also your webserver and the user's browser 
to account for, both of which handle data according to the defaults of 
the browser.

My solution to this problem was to standardize on UTF-8 and then use 
mbstring and iconv to convert everything to UTF-8.  It's still not 
perfect as there are still characters that aren't converted properly. 
But by and large, it's extremely rare considering the amount of data 
we're dealing with.

We also chose to use PHP to pull the data out of db and write to file. 
By doing this, we were able to make sure the data was encoded correctly.

Charley



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

* Re: [SQL] Question regarding multibyte.
@ 2007-02-04 23:26  Ivo Rossacher <rossacher@bluewin.ch>
  parent: Karthikeyan Sundaram <skarthi98@hotmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Ivo Rossacher @ 2007-02-04 23:26 UTC (permalink / raw)
  To: pgsql-admin@postgresql.org

Am Sonntag, 4. Februar 2007 22.34 schrieb Karthikeyan Sundaram:
> Hi,
>
>    I am new to postgres.  I asked a question regarding multibyte display. 
> I got only one response.

Which was correct and about complet when taking the amount of information 
given into account. So nobody else did see a need for an other answer.

> Hence, I am re-iterating the question again to a larger audience.
>
> We are using 8.2 release of postgres.  Recently we converted our database
> to multibyte on our dev machine. we want to test the following.
>
>    1) How will I insert multibyte from our php?  Do we need to use any
> special encoding?

You need to specify the client encoding of your php installation. (the last 
time I used it I think it was Latin1 for me) So after the connection is 
established send something like "set client_encoding='LATIN1'" to the server. 
From then on the server will automatically convert between the client and the 
server encoding for you.

>    2) I am using psql command line to get the data into a flat file and
> push to our data warehouse
>        We use IBM redbrick warehouse.

Here you need to find a way which makes your shell and the data warehouse 
happy. It depends on the data you have to transfer what will give the best 
solution. Here a very simple one which might create troubles in some special 
cases:
If you know the encoding your ware house is expecting just set the client 
encoding of the psql to what you ware house expects. Now the ware house 
should be able to read what from psql comes where mostpossible at the console 
you will not get the correct display anymore whit this setup.

>    3) If I have multibyte, I know the output from the psql will scatter to
> many lines.  How can we avoid that.  What is the sql command ? I need 1
> record per row to supply to our warehouse.

This is most probably only a problem of the editor/console related to wrong 
encoding settings and does not have anything to do with the real problem.
If this is not the case you have to escape the linebreakes in a way the 
warehouse understands (iconv, recode,...).

>
>     Can somebody help me?

I hope so.

Best regards
Ivo Rossacher
>
> Regards
> skarthi
>
> _________________________________________________________________
> Valentine’s Day -- Shop for gifts that spell L-O-V-E at MSN Shopping
> http://shopping.msn.com/content/shp/?ctId=8323,ptnrid=37,ptnrdata=24095&tco
>de=wlmtagline
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>                http://archives.postgresql.org



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


end of thread, other threads:[~2007-02-04 23:26 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-02-02 19:51 Question regarding multibyte. Karthikeyan Sundaram <skarthi98@hotmail.com>
2007-02-04 21:34 ` Karthikeyan Sundaram <skarthi98@hotmail.com>
2007-02-04 22:30   ` Michael Fuhr <mike@fuhr.org>
2007-02-04 22:44   ` Charley Tiggs <lists@tiggs.net>
2007-02-04 23:26   ` Ivo Rossacher <rossacher@bluewin.ch>

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