Jump to content

parsing backwards


alarik149

Recommended Posts

Hi people. I have a very interesting issue here, or it is interesting from my point of view.

I have a database with a lot of names and some of them are german or french or any other language that has special characters.

 

let's say we want to add "Jádson" to the database.

when added,in the database I find "Jádson" instead of "Jádson". It is quite OK because when I try to echo each field, in any browser, I see "Jádson" not "Jádson",and this is what I want.

 

The problem is when I try to search something in the database. If I make a link,something like www.site.com/$name and each time $name changes,when I get to "Jádson" it dosen't find any entry in the database with that name, because in the database it is actually "Jádson", so I can't use any information for this guy. I guess everyone sees my problem.

 

I need 2 things.

 

1 - First of all I need a way, an algorithm to parse back from "Jádson" to "Jádson", that workes for any kind of characters,not just this. For example, if I input in a field "Jádson" I should get back this string -> "Jádson".

 

2 - Secondly, I need a way, an algorithm that can change any name like "Jádson" or "Jérémy" or "Tomić" to

"Jadson" and "Jeremy" or "Tomic" .

 

Cheers and thank you for banging your head along with me.

Link to comment
Share on other sites

For your second question, that can only be done by a lookup table, not an algorithm.  Unfortunately I can't help you with finding the table.

 

Basically you need a table showing each accented character along with its plain equivalent, for every language that you plan to handle, and for whichever encoding you are using (utf8?).  Then you just run the string through that table, making the appropriate conversions.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.