Skip to content

Instantly share code, notes, and snippets.

View pkruithof's full-sized avatar

Peter Kruithof pkruithof

  • TreeHouse
  • Breda, NL
View GitHub Profile
@pkruithof
pkruithof / utf_to_ascii.php
Created June 22, 2011 13:07
UTF-8 to ASCII
<?php
$str = $_REQUEST['body'];
for ($i = 0; $i < strlen($str); $i++) {
$byte = $str[$i];
if (ord($byte) > 127) {
$output .= "\\x" . bin2hex($byte);
} else {