Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP & MSSQL - Probleme mit Umlauten und anderen Sonderzeichen

Empfohlene Antworten

Veröffentlicht

Hallo,

ich arbeite an einer PHP-Webanwendung die Daten aus einer Microsoft SQL Server 2008-Datenbank ausliest, anzeigt und Änderungen speichert. Nun stoße ich auf das Problem, dass Umlaute beim Speichern verfremdet werden (z.B. "ä" statt "ä").

Wie kann man das Problem beheben?

Ich habe jetzt in jede PHP-Datei folgenden Header gesetzt:

header('Content-Type: text/html; charset=utf-8');

Nun werden Umlaute auch als solche angezeigt. In der Datenbank sind die Werte dennoch als "ä" und Ähnliches abgespeichert, aber da selbst meine Suchfunktion damit funktioniert macht mir das erstmal nichts aus.

Dann werde ich das noch anpassen müssen.

Gibt es etwas Vergleichbares zu mysql_real_escape_string() für MSSQL?

Gibt es etwas Vergleichbares zu mysql_real_escape_string() für MSSQL?

Nativ ist mir nichts bekannt. Ich würde eh dazu übergehen eine Schnittstelle wie PDO bzw ADODB zu verwenden, dort sind dann passende Methoden implementiert

Ich habe beide Begriffe mal gegooglet. Das ist mir zu viel Aufwand, da bastel ich mir doch lieber eine Funktion und ersetze unerwünschte Zeichen mit einem "".

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.