PHP, MySQL and extended characters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James

    PHP, MySQL and extended characters


    In oracle I can do the following:

    select CONVERT(COLUMNO FNAMES,'US7ASCI I') from mytable --

    It will take a name like Albrecht Dürer and change it into Albrecht
    Durer and is useful in where clauses where you do not know if a user is
    going to enter u or ü -- I convert the user input into Durer as well
    as the column and query against it and get hits ........ very useful.

    I can't seem to get something similar working with MySQL --

    where ( convert(COLUMNO FNAMES using swe7) like '%durer%'

    produces no hits -- I ran a select and it seemed to be convert the ü
    into a question mark .... my default character set is latin1 - the
    characters are displaying ok in the php pages.

    Anybody got a clue if there is anyway to get this working --
    essentially diacritic insensative searching. Working great in Oracle
    -- but only because of the way the US7ASCII set maps characters like ü
    on u ....

  • Stephen Kay

    #2
    How should I deal with this? Automatic translation problem

    I'm trying to run pages of my site through an automatic translation program
    such as babelfish.

    I've written a code module translate.php, that gets the URL of the current
    page, formats the query string etc. correctly to call babelfish, and then
    calls the babelfish translation page using curl.

    This actually works, and returns my page, all nicely translated into some
    other language.

    The problem I've run into is that, after the first translation, the page
    comes back with babelfishes URLs prefixed to all URLs in the HTML. So if you
    click another link, it also gets translated the same way. Actually, this is
    great and wonderful except that I have a series of buttons on the bottom
    that translate to different languages. So now the buttons, instead of
    calling my translate.php function directly, will attempt to call it through
    the translation page first, which totally screws it up.

    What I want is the page to come back translated, yet somehow reset only the
    certain URLs on the translate buttons so that they again call my
    translate.php code directly, without the babelfish prefix.

    Am I correct in thinking that I must somehow load the page into memory (from
    babelfish), then search through it for the strings I want to replace, and
    "edit" the HTML code, before I actually send it for output and display?

    Any pointers/tips on doing this, or is there some easier way of dealing with
    this? Thanks much.

    --
    Stephen Kay
    Karma-Lab sk@karma-lab.NOSPAM.com
    ^^^^^^^


    Comment

    • David Quinton

      #3
      Re: How should I deal with this? Automatic translation problem

      On Tue, 21 Mar 2006 21:57:00 GMT, Stephen Kay
      <sk@karma-lab.nospam.com> wrote:
      [color=blue]
      >Am I correct in thinking that I must somehow load the page into memory (from
      >babelfish), then search through it for the strings I want to replace, and
      >"edit" the HTML code, before I actually send it for output and display?
      >
      >Any pointers/tips on doing this, or is there some easier way of dealing with
      >this? Thanks much.[/color]


      I'd say 'yes'.

      I think I'd cheat and use javascript write for the ones that you
      didn't want to be changed. But I accept that isn't the most
      satisfactory solution
      --
      Locate your Mobile phone: <http://www.bizorg.co.u k/news.html>
      Great gifts: <http://www.ThisBritain .com/ASOS_popup.html >

      Comment

      Working...