<< All Posts

How to remove UTF-8 BOM characters in your NuSoap + PHP

I was working with webservices using PHP yesterday and I got some strange characters in my WSDL page.

These characters are: 

From Wikipedia: (http://en.wikipedia.org/wiki/Byte_order_mark)

“The byte order mark (BOM) is a Unicode character used to signal the endianness (byte order) of a text file or stream. It is encoded at U+FEFF byte order mark (BOM). BOM use is optional, and, if used, should appear at the start of the text stream. Beyond its specific use as a byte-order indicator, the BOM character may also indicate which of the several Unicode representations the text is encoded in.”

<?xml version="1.0" encoding="UTF-8"?>

After a hardly time wasted working on it, I finally found the solution. Two things:

$server->soap_defencoding = 'UTF-8';
$server->decode_utf8 = false;
$server->encode_utf8 = true;

I also tryed to change the defaultcharset encoding in my php.ini and httpd.conf. But it didnt’t work so well.

The really solution was change the charset of my config.php


Can you belive? It killed all my worries.

<< All Posts


🇧🇷 🇨🇦
Runs on OpenBSD 🐡