| |||||||
Du magst keine Werbung? Wir auch nicht!
Einfach registrieren und die Werbung ist weg. Diese Nachricht sehen nur nicht registrierte Nutzer.
![]() |
| | LinkBack | Themen-Optionen | Ansicht |
| | #1 (permalink) |
| Neuer User Registriert seit: Feb 2003 Ort: Berlin
Beiträge: 61
| Problem mit PHP-Skript und utf8 encode
Habe ein News-Update gebaut, was auch ganz gut funktioniert, nur habe ich das Problem mit den Umlauten. Verwende dazu das FlaWRITE online Tool. Das Skript erstellt eine .txt-Datei auf dem Server, mein News_mc liest diese Datei ein. Sobald ich den Text "manuell" als utf8 speicher, werden die Umlaute dargestellt. Nun die Frage: Wo und wie baue ich denn in folgendem Skript ein, das er den Text als UTF8 speichert (geht bestimmt irgendwie mit "utf8 encode"). Bin totaler PHP-Laie... Für Hilfe total dankbar... <? //--------------------------------------------------------------------------- // FlaWRITE online 1.1 // Joscha Feth // Metzingen, Germany June 2001 // FLASHTOOL // http://www.flashtool.de //--------------------------------------------------------------------------- $filter_array = array (".txt",".flb"); function ext_allowed($ext,$ext_array) { if(in_array($ext,$ext_array)) { return 1; } else { return 0; } }; function strip_ext($filename) { return strchr($filename,"."); }; function draw_header() { header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT"); header ("Cache-Control: no-cache, must-revalidate"); header ("Pragma: no-cache"); }; function create_file($file_path) { global $filter_array; if (!ext_allowed(strip_ext($file_path),$filter_array) ) { return 0; } else { if ($file = @fopen($file_path,"w")) { data2add($file); @fclose($file); return 1; } else { return 0; } } }; function delete_file($file_path) { if(!@unlink($file_path)) { return 0; } else { return 1; } }; function getBaseVariables() { global $HTTP_GET_VARS; global $HTTP_POST_VARS; $var_post_array = $HTTP_POST_VARS; $var_get_array = $HTTP_GET_VARS; return array_merge($var_post_array, $var_get_array); }; function output_vars($state) { if (!$state) { // 2 means error return "&vars_loaded=2&"; } else { // 1 means all is okay return "&vars_loaded=1&"; } }; function data2add($file) { $vars2write = getBaseVariables(); while (list($key,$value) = each($vars2write)) { if ($value != "" && $key != "file_path") { $value = str_replace("&","%26",$value); fputs($file,"&".$key."=".$value."&"); } } }; function append_file($file_path) { global $filter_array; if (!ext_allowed(strip_ext($file_path),$filter_array) ) { return 0; } else { if ($file = @fopen($file_path,"a")) { data2add($file); @fclose($file); return 1; } else { return 0; } } }; function load_file($file_path) { if($fcontent = file($file_path)) { while (list($key, $value) = each($fcontent)) { $value = trim($value); if ($value != "") { echo $value; } } return 1; } else { return 0; } }; ?>
__________________ Hamlet http://www.solo-media.de Berlin |
| | |
| | #2 (permalink) |
| muh Registriert seit: Apr 2002 Ort: Freiburg / Stuttgart
Beiträge: 4.338
|
hier, ich glaube hier solltest du mal hingucken: PHP-Code: fputs($file,"&".$key."=".$value."&"); würde ich mal fputs($file,"&".$key."=".utf8_encode($value)."&"); versuchen. |
| | |
![]() |
| Lesezeichen |
| Themen-Optionen | |
| Ansicht | |
| |