Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    25

    Unanswered: national characters

    Hi

    I am new to postgre and have following problem

    I have table that has column surname that contain also national characters like á í ľ š č š ú ľ .....

    I would like to write procedure which will convert data from this column to ascii encoding only so I can try to find matches also in case user has wrong spelling.

    for example it should turn 'barcíková' into 'barcikova'

    I was thinking about one function that would replace all vowels in searched name into regular expression

    example
    it would turn 'barcíková' into 'b(a|á)r(c|4)(í|i)k)(o|ó)v(á|a)'

    and than use regexp to proceed the search

    Am I on the right way ?
    Is it possible ?
    ...

    thanx

  2. #2
    Join Date
    Apr 2004
    Posts
    1
    Quote Originally Posted by mikosan
    Hi
    I have table that has column surname that contain also national characters like á í ľ š č š ú ľ .....

    I would like to write procedure which will convert data from this column to ascii encoding only so I can try to find matches also in case user has wrong spelling.

    for example it should turn 'barcíková' into 'barcikova'
    I don't know which character set you are using, but if it is LATIN1, LATIN2 or WIN1250 you might find the function to_ascii useful, see:

    http://sql-info.de/postgresql/postfaq.html#5_4

  3. #3
    Join Date
    Mar 2004
    Posts
    25

    Thumbs up thanx a lot

    it works perfectly with to_acii()

    SELECT surname, name, pid, FROM pacient WHERE to_ascii(surname) ILIKE to_ascii('Holecka%') || '' || ''ORDER BY priezvisko "

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •