Damijan on code

Code, hints, tutorials ...

Monday, May 30, 2011

How to convert html encoded string to utf8

When I need to convert string from html encoded to e.g. UTF8 I use the next line of code:

html_entity_decode(strip_tags($strBody), null, 'UTF-8')

First I strip all the html tags and then decode the string.
Posted by Damijan at 5/30/2011
Labels: convert, decode, html, php, string, utf8

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Pages

  • Blog
  • LinkedIn
  • GitHub
  • Bitbucket

Blog Archive

  • ►  2013 (5)
    • ►  March (3)
    • ►  February (2)
  • ►  2012 (12)
    • ►  December (2)
    • ►  October (5)
    • ►  September (1)
    • ►  August (2)
    • ►  July (1)
    • ►  April (1)
  • ▼  2011 (10)
    • ►  July (2)
    • ►  June (1)
    • ▼  May (4)
      • Safe file_get_contents
      • How to convert html encoded string to utf8
      • How to fix image color dept problem or why does th...
      • SVN: How to list all the changes made by uses in a...
    • ►  April (3)
  • ►  2010 (3)
    • ►  September (2)
    • ►  January (1)
  • ►  2009 (20)
    • ►  December (1)
    • ►  November (1)
    • ►  October (3)
    • ►  May (2)
    • ►  April (2)
    • ►  March (2)
    • ►  February (9)
  • ►  2008 (1)
    • ►  October (1)
Simple theme. Powered by Blogger.