title: Delphi, MSXML2.XMLHTTP, PHP and Win-1250 charset encoding
body: <p>Hoi!</p>
  
  <p>I trying to make a webservice in Windows.</p>
  
  <p>The client is Delphi 6, with MSXML2.XMLHTTP call, and other side is PHP.</p>
  
  <p>First I tested: can I receive hungarian XML? </p>
  
  <p>The PHP source was UTF-8 encoded file (PSPAD).</p>
  
  <pre><code>$s = 'alma árvíztűrő tükörfúrógép beta';
  $doc = new DOMDocument('1.0', 'utf-8');
  $doc-&gt;formatOutput = true;
  $m = $doc-&gt;createElement('package');
  $doc-&gt;appendChild($m);
  $n = $doc-&gt;createElement('Msg');
  $m-&gt;appendChild($n);
  $n-&gt;nodeValue = $s;
  $xs = $doc-&gt;saveXML();
  header('Content-Type: text/xml');
  echo($xs);
  </code></pre>
  
  <p>This package I fully got in Delphi side, the accents are ok.</p>
  
  <p>So then I tried to inject data from xml (post xml to php with accents).</p>
  
  <pre><code>global $HTTP_RAW_POST_DATA;
  $xmlstr = $HTTP_RAW_POST_DATA;
  $xml = new SimpleXMLElement($xmlstr);
  $msg = $xml-&gt;msg;
  #$msg = 'ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP';
  </code></pre>
  
  <p>Ok, I got the "msg" field, but nevertheless I trying to convert it, everytime I got some convert notice, and the result is not same as when I set the variable directly...</p>
  
  <p>The debug is:</p>
  
  <pre><code>echo(utfCharToNumber($sinput).'&lt;br&gt;');
  echo(utfCharToNumber($sdefined).'&lt;br&gt;');
  
  Input:   195[   ]8286195141908419717682197[   ]328419
  Defined: 195[129]8286195141908419717682197[144]328419
  Input:   5156751951508270195154821951477119513780&lt;br&gt;
  Defined: 5156751951508270195154821951477119513780&lt;br&gt;
  </code></pre>
  
  <p>As you see that two holes I have in the variable when I converted the input from MSXML2.</p>
  
  <p>I really don't understand this.</p>
  
  <p>I cannot reproduce same XML output from get the data from input XML as when I set directly in PHP code...</p>
  
  <p>Why?</p>
  
  <p>Thanks for your every help, idea, link, document, little example!</p>
  
  <p>dd</p>