Skip to main content
added 230 characters in body; added 88 characters in body
Source Link
Mark Byers
  • 843.3k
  • 202
  • 1.6k
  • 1.5k

TryI'm assuming by "awkward characters" you mean anything that is not ASCII. If so, then try iconviconv:

$addr = iconv('UTF-8', 'ASCII//TRANSLIT', $addr);

The first argument is the character set of the input string.

$addr = "Hellö";
echo $addr . "\n";
$addr = iconv('UTF-8', 'ASCII//TRANSLIT', $addr);
echo $addr . "\n";

Output


Hellö
Hello

See it run at ideone.

Try iconv:

$addr = iconv('UTF-8', 'ASCII//TRANSLIT', $addr);

The first argument is the character set of the input string.

I'm assuming by "awkward characters" you mean anything that is not ASCII. If so, then try iconv:

$addr = iconv('UTF-8', 'ASCII//TRANSLIT', $addr);

The first argument is the character set of the input string.

$addr = "Hellö";
echo $addr . "\n";
$addr = iconv('UTF-8', 'ASCII//TRANSLIT', $addr);
echo $addr . "\n";

Output


Hellö
Hello

See it run at ideone.

Source Link
Mark Byers
  • 843.3k
  • 202
  • 1.6k
  • 1.5k

Try iconv:

$addr = iconv('UTF-8', 'ASCII//TRANSLIT', $addr);

The first argument is the character set of the input string.