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
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
Share on other sites

  • 2 months later...
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.