PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
php umlaute in .txt Datei schreiben und lesen
Beitrag
<blockquote data-quote="Dennis__" data-source="post: 1090885" data-attributes="member: 335784"><p><strong>AW: php umlaute in .txt Datei schreiben und lesen</strong></p><p></p><p><span style="color: Black">Versuche mal den String, den du beim Einlesen der Textdatei erhälst, durch eine Ersetzfunktion (</span><span style="color: Black">str_replace)</span><span style="color: Black"> laufen zulassen, bevor du ihn ausgibst. Dadurch kannst du alle Umlaute, die kryptisch in dem String vorkommen durch die richtigen ersetzen:</span></p><p><span style="color: Black"></span></p><p><span style="color: Black">$str = str_replace('#', 'ü', $str);</span></p><p><span style="color: Black"></span></p><p><span style="color: Black"></span></p><p><span style="color: Black"></span></p><p><span style="color: Black">Also könnte das ungefähr so aussehen:</span></p><p><span style="color: Black"></span></p><p><span style="color: Black"><span style="color: #000000"> <span style="color: #0000bb"><?</span></span></span></p><p><span style="color: Black"><span style="color: #000000"><span style="color: #0000bb">$dateiname </span><span style="color: #007700">= </span><span style="color: #dd0000">"guestbook.txt"</span><span style="color: #007700">;</span></span></span></p><p><span style="color: Black"><span style="color: #000000"><span style="color: #007700"></span></span></span></p><p><span style="color: Black"><span style="color: #000000"><span style="color: #007700"></span><span style="color: #0000bb">$datei </span><span style="color: #007700">= </span><span style="color: #0000bb">fopen</span><span style="color: #007700">(</span><span style="color: #0000bb">$dateiname</span><span style="color: #007700">, </span><span style="color: #dd0000">"r"</span><span style="color: #007700">);</span></span></span></p><p><span style="color: Black"><span style="color: #000000"><span style="color: #007700"></span><span style="color: #0000bb">$wert </span><span style="color: #007700">= </span><span style="color: #0000bb">fgets</span><span style="color: #007700">(</span><span style="color: #0000bb">$datei</span><span style="color: #007700">, </span><span style="color: #0000bb">100000</span><span style="color: #007700">);</span></span></span></p><p><span style="color: Black"><span style="color: #000000"><span style="color: #007700"></span><span style="color: #0000bb">fclose</span><span style="color: #007700">(</span><span style="color: #0000bb">$datei</span><span style="color: #007700">);</span></span></span></p><p><span style="color: Black"><span style="color: #000000"><span style="color: #007700"></span></span></span></p><p><span style="color: Black"><span style="color: #000000"><span style="color: #007700"></span></span><span style="color: #000000"><span style="color: #0000bb">$wert </span></span>= str_replace('+', 'ä', </span><span style="color: Black"><span style="color: #000000"><span style="color: #0000bb">$w</span></span></span><span style="color: Black"><span style="color: #000000"><span style="color: #0000bb">ert</span></span></span><span style="color: Black">);</span></p><p> <span style="color: Black"></span><span style="color: Black"><span style="color: #000000"><span style="color: #0000bb">$w</span></span></span><span style="color: Black"><span style="color: #000000"><span style="color: #0000bb">ert </span></span>= str_replace('*', 'ö', </span><span style="color: Black"><span style="color: #000000"><span style="color: #0000bb">$w</span></span></span><span style="color: Black"><span style="color: #000000"><span style="color: #0000bb">ert</span></span></span><span style="color: Black">);</span></p><p> <span style="color: Black"></span><span style="color: Black"><span style="color: #000000"><span style="color: #0000bb">$w</span></span></span><span style="color: Black"><span style="color: #000000"><span style="color: #0000bb">ert </span></span>= str_replace('#', 'ü', </span><span style="color: Black"><span style="color: #000000"><span style="color: #0000bb">$w</span></span></span><span style="color: Black"><span style="color: #000000"><span style="color: #0000bb">ert</span></span></span><span style="color: Black">);</span></p><p><span style="color: Black"><span style="color: #000000"><span style="color: #007700"></span></span></span></p><p><span style="color: Black"><span style="color: #000000"><span style="color: #007700">print </span><span style="color: #dd0000">"&main=$wert"</span><span style="color: #007700">;</span></span></span></p><p><span style="color: Black"><span style="color: #000000"><span style="color: #007700"></span><span style="color: #0000bb">?></span> </span> </span></p><p><span style="color: Black"></span></p><p><span style="color: Black">(Die Zeichen +,*,# stimmen natürlich nicht, sollen das ganze nur veranschaulichen)</span></p><p><span style="color: Black"></span></p><p><span style="color: Black">Du must als ersten Übergabeparameter der Funktion, das Zeichen übergeben, das durch das Zeichen ersetzt werden soll, das als zweiter Übergabeparameter angegeben ist. Der letzte Übergabeparameter ist der String.</span></p><p><span style="color: Black"></span></p></blockquote><p></p>
[QUOTE="Dennis__, post: 1090885, member: 335784"] [b]AW: php umlaute in .txt Datei schreiben und lesen[/b] [COLOR=Black]Versuche mal den String, den du beim Einlesen der Textdatei erhälst, durch eine Ersetzfunktion ([/COLOR][COLOR=Black]str_replace)[/COLOR][COLOR=Black] laufen zulassen, bevor du ihn ausgibst. Dadurch kannst du alle Umlaute, die kryptisch in dem String vorkommen durch die richtigen ersetzen: $str = str_replace('#', 'ü', $str); Also könnte das ungefähr so aussehen: [COLOR=#000000] [COLOR=#0000bb]<? $dateiname [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"guestbook.txt"[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]$datei [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]fopen[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$dateiname[/COLOR][COLOR=#007700], [/COLOR][COLOR=#dd0000]"r"[/COLOR][COLOR=#007700]); [/COLOR][COLOR=#0000bb]$wert [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]fgets[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$datei[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]100000[/COLOR][COLOR=#007700]); [/COLOR][COLOR=#0000bb]fclose[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$datei[/COLOR][COLOR=#007700]); [/COLOR][/COLOR][COLOR=#000000][COLOR=#0000bb]$wert [/COLOR][/COLOR]= str_replace('+', 'ä', [/COLOR][COLOR=Black][COLOR=#000000][COLOR=#0000bb]$w[/COLOR][/COLOR][/COLOR][COLOR=Black][COLOR=#000000][COLOR=#0000bb]ert[/COLOR][/COLOR][/COLOR][COLOR=Black]); [/COLOR][COLOR=Black][COLOR=#000000][COLOR=#0000bb]$w[/COLOR][/COLOR][/COLOR][COLOR=Black][COLOR=#000000][COLOR=#0000bb]ert [/COLOR][/COLOR]= str_replace('*', 'ö', [/COLOR][COLOR=Black][COLOR=#000000][COLOR=#0000bb]$w[/COLOR][/COLOR][/COLOR][COLOR=Black][COLOR=#000000][COLOR=#0000bb]ert[/COLOR][/COLOR][/COLOR][COLOR=Black]); [/COLOR][COLOR=Black][COLOR=#000000][COLOR=#0000bb]$w[/COLOR][/COLOR][/COLOR][COLOR=Black][COLOR=#000000][COLOR=#0000bb]ert [/COLOR][/COLOR]= str_replace('#', 'ü', [/COLOR][COLOR=Black][COLOR=#000000][COLOR=#0000bb]$w[/COLOR][/COLOR][/COLOR][COLOR=Black][COLOR=#000000][COLOR=#0000bb]ert[/COLOR][/COLOR][/COLOR][COLOR=Black]); [COLOR=#000000][COLOR=#007700] print [/COLOR][COLOR=#dd0000]"&main=$wert"[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]?>[/COLOR] [/COLOR] (Die Zeichen +,*,# stimmen natürlich nicht, sollen das ganze nur veranschaulichen) Du must als ersten Übergabeparameter der Funktion, das Zeichen übergeben, das durch das Zeichen ersetzt werden soll, das als zweiter Übergabeparameter angegeben ist. Der letzte Übergabeparameter ist der String. [/COLOR] [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 5, ▼ = 2 und ■ = 7, was ist ▲ × ▼ + ■?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
php umlaute in .txt Datei schreiben und lesen
Oben