P
P
pixal2016-04-27 02:14:31
PHP
pixal, 2016-04-27 02:14:31

How can I convert a utf8 with bom file to without bom in php?

There is a resource that contains json in utf8 with bom. Tell me please, how can I copy it to myself in php with conversion to without bom, or convert it in the code itself?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nazar Mokrinsky, 2016-04-27
@nazarpc

function without_bom ($text) {
    if (substr($text, 0, 3) == "\xEF\xBB\xBF") {
        return substr($text, 3);
    }
    return $text;
}

https://en.wikipedia.org/wiki/Byte_order_mark

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question