Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 29-06-2004, 11:54   #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
HamletBSM ist offline   Mit Zitat antworten
Alt 29-06-2004, 13:34   #2 (permalink)
muh
 
Benutzerbild von Janoscharlipp
 
Registriert seit: Apr 2002
Ort: Freiburg / Stuttgart
Beiträge: 4.338
hier, ich glaube hier solltest du mal hingucken:

PHP-Code:
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."&");
}
}
}; 
statt

fputs($file,"&".$key."=".$value."&");

würde ich mal
fputs($file,"&".$key."=".utf8_encode($value)."&");
versuchen.
Janoscharlipp ist offline   Mit Zitat antworten
Alt 29-06-2004, 15:21   #3 (permalink)
Neuer User
 
Registriert seit: Feb 2003
Ort: Berlin
Beiträge: 61
Nee, das hat leider nicht funktioniert...

Problem immer noch vorhanden...
__________________
Hamlet
http://www.solo-media.de
Berlin
HamletBSM ist offline   Mit Zitat antworten
Alt 29-06-2004, 16:04   #4 (permalink)
muh
 
Benutzerbild von Janoscharlipp
 
Registriert seit: Apr 2002
Ort: Freiburg / Stuttgart
Beiträge: 4.338
dann mach mal alles, auch das &...= in das utf-encode.
Janoscharlipp ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 04:39 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele