public inbox for [email protected]  
help / color / mirror / Atom feed
to_ascii function
3+ messages / 2 participants
[nested] [flat]

* to_ascii function
@ 2004-06-05 13:39 Halley Pacheco de Oliveira <[email protected]>
  2004-06-07 09:16 ` Re: to_ascii function Karel Zak <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Halley Pacheco de Oliveira @ 2004-06-05 13:39 UTC (permalink / raw)
  To: pgsql-docs

This query didn't work as I was expecting. Any reasons
for that ?

SELECT TO_ASCII('ÁÉÍÓÚáéíóúªº°')

result -> 'AEIOUaeioua  '

I used psql, java and phpPgAdmin without success.

(PostgreSQL 7.4.2 encoding latin1)

Regards,
Halley

______________________________________________________________________

Participe da pesquisa global sobre o Yahoo! Mail: 
http://br.surveys.yahoo.com/global_mail_survey_br



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

* Re: to_ascii function
  2004-06-05 13:39 to_ascii function Halley Pacheco de Oliveira <[email protected]>
@ 2004-06-07 09:16 ` Karel Zak <[email protected]>
  2004-06-07 21:28   ` Re: to_ascii function Halley Pacheco de Oliveira <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Karel Zak @ 2004-06-07 09:16 UTC (permalink / raw)
  To: Halley Pacheco de Oliveira <[email protected]>; +Cc: pgsql-docs

On Sat, Jun 05, 2004 at 10:39:15AM -0300, Halley Pacheco de Oliveira wrote:
> This query didn't work as I was expecting. Any reasons
> for that ?
> 
> SELECT TO_ASCII('ÁÉÍÓÚáéíóú??°')
> 
> result -> 'AEIOUaeioua  '
> 
> I used psql, java and phpPgAdmin without success.
> 
> (PostgreSQL 7.4.2 encoding latin1)

 Are all chars  in your query LATIN1  symbols and are you  sure that all
 used  chars  have counterpart  in  ASCII? For  this to_ascii()  support
 LATIN1, LATIN2  and WIN1250 only. I'm  not sure if  there is a  way how
 convert others special chars (for example some Asiatic encodings).

 # show server_encoding;
 server_encoding 
 -----------------
 LATIN1

 # show client_encoding;
 client_encoding 
 -----------------
 LATIN1

 # SELECT '>>' || TO_ASCII('ÁÉÍÓÚáéíóú??°') || '<<';
     ?column?      
 -------------------
 >>AEIOUaeiou?? <<
 

 The last char  in the string is dec 176 (hex 0xB0). Which  char do you
 expect after conversion to ASCII (0-127)?

    Karel

-- 
 Karel Zak  <[email protected]>
 http://home.zf.jcu.cz/~zakkr/



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

* Re: to_ascii function
  2004-06-05 13:39 to_ascii function Halley Pacheco de Oliveira <[email protected]>
  2004-06-07 09:16 ` Re: to_ascii function Karel Zak <[email protected]>
@ 2004-06-07 21:28   ` Halley Pacheco de Oliveira <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Halley Pacheco de Oliveira @ 2004-06-07 21:28 UTC (permalink / raw)
  To: pgsql-docs; +Cc: Karel Zak <[email protected]>

Dear Karel,

The server encoding and the client encoding are
LATIN1. These results are from phpPgAdmin:

This is ok:

select ascii('ª')

ascii
-----
170

select chr(170)

chr
---
ª

select to_ascii(chr(170))

to_ascii
--------
a

But this is not ok!

select ascii('º')

ascii
-----
186

select chr(186)

chr
---
º

select to_ascii(chr(186))

to_ascii
--------
 

select ascii(to_ascii(chr(186)))

ascii
-----
32

I think that if to_ascii of ª (170) is a, then
to_ascii of º (186) should be o, and not space.

Halley
 --- Karel Zak <[email protected]> escreveu: > On Sat,
Jun 05, 2004 at 10:39:15AM -0300, Halley
> Pacheco de Oliveira wrote:
> > This query didn't work as I was expecting. Any
> reasons
> > for that ?
> > 
> > SELECT TO_ASCII('ÁÉÍÓÚáéíóú??°')
> > 
> > result -> 'AEIOUaeioua  '
> > 
> > I used psql, java and phpPgAdmin without success.
> > 
> > (PostgreSQL 7.4.2 encoding latin1)
> 
>  Are all chars  in your query LATIN1  symbols and
> are you  sure that all
>  used  chars  have counterpart  in  ASCII? For  this
> to_ascii()  support
>  LATIN1, LATIN2  and WIN1250 only. I'm  not sure if 
> there is a  way how
>  convert others special chars (for example some
> Asiatic encodings).
> 
>  # show server_encoding;
>  server_encoding 
>  -----------------
>  LATIN1
> 
>  # show client_encoding;
>  client_encoding 
>  -----------------
>  LATIN1
> 
>  # SELECT '>>' || TO_ASCII('ÁÉÍÓÚáéíóú??°') || '<<';
>      ?column?      
>  -------------------
>  >>AEIOUaeiou?? <<
>  
> 
>  The last char  in the string is dec 176 (hex 0xB0).
> Which  char do you
>  expect after conversion to ASCII (0-127)?
> 
>     Karel
> 
> -- 
>  Karel Zak  <[email protected]>
>  http://home.zf.jcu.cz/~zakkr/ 


______________________________________________________________________

Participe da pesquisa global sobre o Yahoo! Mail: 
http://br.surveys.yahoo.com/global_mail_survey_br




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


end of thread, other threads:[~2004-06-07 21:28 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-06-05 13:39 to_ascii function Halley Pacheco de Oliveira <[email protected]>
2004-06-07 09:16 ` Karel Zak <[email protected]>
2004-06-07 21:28   ` Halley Pacheco de Oliveira <[email protected]>

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