Thread: dbf2pg international characters handling incomplete

dbf2pg international characters handling incomplete

From
Márcio Dick Smiderle
Date:
Your name: Márcio Dick Smiderle
Your email address: dick@inf.ufsc.br


System Configuration
---------------------  Architecture : k62 300
  Operating System : Linux 2.4.21 elf
  PostgreSQL version :  PostgreSQL-7.2.1 and CVS(just dbf2pg)
  Compiler used : gcc-3.3 and gcc-2.95


Please enter a FULL description of your problem:
------------------------------------------------
 dbf2pg interprets international chars (áéíóú etc) as end of record
cell text.


Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

Run dbf2pg with some records with non-ascii chars.


If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

In the main() of dbf2pg add the line
   setlocale(LC_ALL, ""); /* For isprint() to work correctly with other
charsets than 7 bit ascii  */




Re: dbf2pg international characters handling incomplete

From
Bruce Momjian
Date:
OK, patch attached and applied for 7.4.  Thanks.

---------------------------------------------------------------------------

M�rcio Dick Smiderle wrote:
> Your name: M?rcio Dick Smiderle
> Your email address: dick@inf.ufsc.br
>
>
> System Configuration
> ---------------------
>    Architecture : k62 300
>
>    Operating System : Linux 2.4.21 elf
>
>    PostgreSQL version :  PostgreSQL-7.2.1 and CVS(just dbf2pg)
>
>    Compiler used : gcc-3.3 and gcc-2.95
>
>
> Please enter a FULL description of your problem:
> ------------------------------------------------
>
>   dbf2pg interprets international chars (????? etc) as end of record
> cell text.
>
>
> Please describe a way to repeat the problem.   Please try to provide a
> concise reproducible example, if at all possible:
> ----------------------------------------------------------------------
>
> Run dbf2pg with some records with non-ascii chars.
>
>
> If you know how this problem might be fixed, list the solution below:
> ---------------------------------------------------------------------
>
> In the main() of dbf2pg add the line
>
>     setlocale(LC_ALL, ""); /* For isprint() to work correctly with other
> charsets than 7 bit ascii  */
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: contrib/dbase/dbf2pg.c
===================================================================
RCS file: /cvsroot/pgsql-server/contrib/dbase/dbf2pg.c,v
retrieving revision 1.18
diff -c -c -r1.18 dbf2pg.c
*** contrib/dbase/dbf2pg.c    8 Aug 2003 20:20:49 -0000    1.18
--- contrib/dbase/dbf2pg.c    27 Sep 2003 22:24:02 -0000
***************
*** 700,705 ****
--- 700,707 ----
      if (verbose > 1)
          printf("Opening dbf-file\n");

+     setlocale(LC_ALL, "");    /* fix for isprint() */
+
      if ((dbh = dbf_open(argv[0], O_RDONLY)) == (dbhead *) - 1)
      {
          fprintf(stderr, "Couldn't open xbase-file %s\n", argv[0]);