html - PHP convert characters applicable for title tag -


in page convert lower uppercase string , output 'em in title tag. first had issue   not accepted, had preserve entities.

so converted them unicode, uppercase , htmlentities:

echo htmlentities(strtoupper(html_entity_decode(ob_get_clean()))); 

now have problem recognized related "right single quote". i'm getting character ’ in title.

it seems either of 2 functions i'm using not convert them correctly. there better function can use or there title tag?

edit: here var_dump of original data don't have influence to:

string(74) "example example example » john doe- who’s that? " 

edit ii: code above results in:

enter image description here

this happen, if use strtoupper:

enter image description here

your problem strtoupper destroy utf-8 entity-decoded input because not multibyte aware. in instance, ’ decodes hex-encoded utf-8 sequence e2 80 99. in strtoupper's single-byte world, character code \xe2 â, converted  (\xc2) -- makes text invalid utf-8 sequence.

simply use mb_strtoupper instead.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -