?
Solved

PHP Turn special characters to normal ones

Posted on 2009-04-15
4
Medium Priority
?
447 Views
Last Modified: 2012-05-06
Hello experts,

I have a website written in html and php.
There I have form, which among other things requests the user to type in their name and first name.
I have to do some further processing with these data.
The problem is that many users have special characters in their names, and that causes errors in my further processings.
Is there a php function to turn the special characters into normal ones? (i.e. á to a)
I use UTF-8.

Thanks for your help
0
Comment
Question by:arthrex
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
niko86 earned 2000 total points
ID: 24155153
you could do this with trtr
$yournewstring=strtr($youtstring,"()!$'?:
,&+-/.`R}aS~x¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ",
"--------------SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");

Open in new window

0
 
LVL 48

Expert Comment

by:hernst42
ID: 24155198
0
 
LVL 5

Expert Comment

by:niko86
ID: 24155213
iconv will not convert special chars to normal ones, it can convert them to utf-8, but that's not what was requested
0
 

Author Closing Comment

by:arthrex
ID: 31570850
PERFECT!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month15 days, 20 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question