News Feed
Jobs Feed
Sections




News Archive
Danne Lundqvist's Blog:
Detecting UTF BOM - byte order mark
April 29, 2010 @ 11:47:03

In a new post to his blog Danne Lundqvist looks at a common pitfall that could trip you up if you're not careful with your UTF-8 data - not looking for the UTF byte order mark that tells the application if it needs to be handled as UTF content.

One such thing is the occurrence of the UTF byte order mark, or BOM. [...] For UTF-8, especially on Windows, it has become more and more common to use it to indicate that the file is indeed UTF. Most text editors handle this well and you won't ever see these bytes. As it should be.

He points out what could cause an issue - using strcmp or substr but it can be prevented by looking at and removing those first three bytes if needed. He includes a snippet of code that does just that.

0 comments voice your opinion now!
byteordermark utf utf8 utf16 detect


blog comments powered by Disqus

Similar Posts

Padraic Brady's Blog: ZF Blog Tutorial Addendum #1: Base URL, Magic Quotes, Database Schema & UTF-8

Ahmed Shreef's Blog: iconv misunderstands UTF-16 strings with no BOM

Phil Sturgeon's Blog: UTF-8 support for CodeIgniter

Project: Patchwork-UTF8 - UTF8 Support for PHP

Danne Lundqvist's Blog: Detecting UTF BOM - byte order mark


Community Events











Don't see your event here?
Let us know!


podcast functional code object introduction interview language framework tool community series zendframework2 development example opinion database testing composer phpunit release

All content copyright, 2013 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework