Make encode_char_entities safe against empty strings, because Graph uses it that way. Fixes bug 4245. Based on patch by Christopher Alfeld.