NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP UTF8 Conversion to ASCII

Peter Sawczynec ps at blu-studio.com
Thu Nov 10 17:13:03 EST 2011


As it turns out we have iconv in our php build and we can use it. 

So I will try that, thank you all.

 

Peter

 

 

From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Jeremy Mikola
Sent: Thursday, November 10, 2011 4:56 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] PHP UTF8 Conversion to ASCII

 

Modern browsers shouldn't really have trouble unicode characters in URL's. I recall seeing a few single-character domain names a while back after unicode became available for registration. Punycode <http://en.wikipedia.org/wiki/Punycode>  is typically employed when displaying hostnames - I believe this is most practically a security measure for avoiding fishing scams with domain names that may look similar.

But to your point, it sounds like you need transliteration. The PHP iconv extension supports this natively:

http://stackoverflow.com/questions/3542717/how-to-transliterate-accented-characters-into-plain-ascii-characters

 

On Thu, Nov 10, 2011 at 4:33 PM, Peter Sawczynec <ps at blu-studio.com> wrote:

From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Chris Snyder
Sent: Thursday, November 10, 2011 4:16 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] PHP UTF8 Conversion to ASCII

 

On Thu, Nov 10, 2011 at 4:11 PM, Peter Sawczynec <ps at blu-studio.com> wrote:

Recently came across the issue where utf8 characters were getting outputted into links like so:

http://example.com/ãcenar <http://example.com/%C3%A3cenar>  [<< where the "a" is a special character], which a browser can turn to links like so: 

http://example.com/ã <http://example.com/%C3%A3> �cenar 

 

In researching, I have found that browsers do not handle special utf8 characters in urls very well.

 

 

Seems like this is exactly what urlencode() is for, no? 

 

[Peter Sawczynec] 

 

My impression was that urlencode translated chars that cannot pass in an URL into entities that can. But those new entities are now  gibberish to the human eye. 

My end reuslt needed is creating user-friendly, clean, attractive urls from utf8 that will render as human-readable characteres in the browser address bar.

And that browsers will not choke on the link when a user clicks it in  web page. 

Are you saying that an urlencoded link will be clickable in a web page and render human-readable in the browser address bar too?

 

 

 


_______________________________________________
New York PHP Users Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/Show-Participation




-- 
jeremy mikola

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20111110/303f5eff/attachment.html>


More information about the talk mailing list