Skip to content

Instantly share code, notes, and snippets.

@lx4r
Created June 17, 2012 12:42
Show Gist options
  • Save lx4r/2944454 to your computer and use it in GitHub Desktop.
Save lx4r/2944454 to your computer and use it in GitHub Desktop.
Tiny script for converting text with some special character problems to normal text
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<?php
$search = array('ü','ö','„',"“",'ä','ß','€');
$replace = array('ü','ö','"','"','ä','ß','€');
if (isset ($_POST["input"]) && isset($_POST["convert"])){
$fail_text = $_POST["input"];
$fixed_text = str_replace($search, $replace, $fail_text);
}
?>
<html>
<head>
<title>Convert</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<form method="post">
<textarea name="input" cols="100" rows="10"></textarea><br />
<input name="convert" type="submit" value="Konvertieren!"><br />
<textarea name="output" cols="100" rows="10" readonly><?php if (isset($fixed_text)){
echo $fixed_text;
} ?></textarea>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment