Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- PHP, MySQL and extended characters
March 21, 2006, 9:48 pm
rate this thread
In oracle I can do the following:
select CONVERT(COLUMNOFNAMES,'US7ASCII') 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(COLUMNOFNAMES 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 ....
How should I deal with this? Automatic translation problem
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
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.
Re: How should I deal with this? Automatic translation problem
I'd say 'yes'.
didn't want to be changed. But I accept that isn't the most
Locate your Mobile phone: <http://www.bizorg.co.uk/news.html
Great gifts: <http://www.ThisBritain.com/ASOS_popup.html