Jump to content

Replace Special Chars


Darkness Soul

Recommended Posts

Yo,

Guys, I need a little help.. or maybe a little function.. I've been seach at php.net function list and don't see nothing like what I need..

I need a function to remove and replace special chars.. to make safe names to the images without cripty then..
exemple:
[code]$image = '#_Àéçomn_01.jpg' ;

$image = fun_rem_spec_char ( $image ) ;

print $image ;[/code]
: _Aecomn_01.jpg

Thanks for the help..

D.Soul
Link to comment
https://forums.phpfreaks.com/topic/14403-replace-special-chars/
Share on other sites

This is a bit of a challenge because you're trying to [i]visually[/i] (not [i]actually[/i]) convert a character set. To my knowledge there is nothing in PHP to do this because, honestly, you shouldn't. See my signature about Unicode and character sets; here's a quote from it: "There Ain't No Such Thing As Plain Text."

Why don't you convert the string to UTF-8 and use it as is? Are you running Unix?

For example:

[tt]<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php

$string = '#_Àéçomn_01.jpg';
echo utf8_encode($string);

?>
</body>
</html>[/tt]
Link to comment
https://forums.phpfreaks.com/topic/14403-replace-special-chars/#findComment-56940
Share on other sites

  • 2 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.