You are not logged in.

  • Login

erti

Unregistered

1

Sunday, March 6th 2011, 7:58pm

encoding Fehler

Hallo!

Ich verwende folgendes Script um eine abfrage zu senden, die anforderung vom serverbetreiber ist das encoding format ISO-8859-1
leider kommt immer ein fehler zurück sobald jemand ein doppel ss oder einen umlaut sendet, wenn aber eine addresse ohne doppel ss oder umlaute eingegeben wird funktioniert alles prima!

PHP Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$xml = "<?xml version='1.0' encoding='ISO-8859-1'?>
<SOAP-ENV:Envelope xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> 
<soap:Body> 
<ns2:checkFeasibility xmlns:ns2='http://sxxxxt/'> 
<Request fcType='ADDRESS' locale='EN'>
<address street='$_POST[strasse]' houseNumber='$_POST[hausnummer]' zipcode='$_POST[plz]' city='$_POST[ort]' block='$_POST[block]' stairs='$_POST[stiege]' floor='$_POST[stock]' door='$_POST[tuer]'/>
</Request> 
</ns2:checkFeasibility>
</soap:Body> 
</soap:Envelope>
</SOAP-ENV:Envelope>";
 
define( 'HOST', 'https://host.domain.at:443/ixxxi/Service?wsdl' );
 
header( 'Content-Type: text/xml' );
requestCurl( $xml );
function requestCurl( $data ) {
$ch = curl_init( HOST );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, FALSE );
if( !$data = curl_exec( $ch )) {
//echo 'Curl execution error.', curl_error( $ch ) ."\n";
return FALSE;
}
curl_close( $ch );
return $data;
}


Der Fehler sieht dann so aus:

XML-Verarbeitungsfehler: nicht wohlgeformt
Adresse: http://www.xxxcheck.php
Zeile Nr. 1, Spalte 81035:

street="Schulstra�e"

auch mit ulauten im ort ist das, das selbe!

mfg.
erti

xml-looser

Unregistered

2

Monday, March 7th 2011, 2:48pm

encoding

ich schau mal wie dein editor encode
häufig in windows cp1252

suche dir ein Editor der das anzeigt wie er codiert und dann auf iso8858-1 einstellen
oder dos

ich benutze ultraedit und codiere nur noch mit in utf-8
damit sind viele Fehler aus geschlossen

3

Tuesday, March 29th 2011, 3:52pm

cp1252 = ISO-8859-1

Ich schäte mal du musst den Inhalt von "$_POST[strasse]" etc. in ISO-8859-1 codieren, falls der Request UTF-8 encoded ist.

hth

Similar threads

Social bookmarks