Branch: Tag:


2018-02-23 20:51:57 by Martin Karlgren <>

Use string_to_utf8 rather than Charset.Encoder when possible.

Previously Charset.Encoder would be selected if the output charset was set to
"utf-8" (but string_to_utf8 would be used for "UTF-8"). string_to_utf8 performs better,
especially when the string already is 7 bits wide.

2949:    protected function charset_function(function|string what, int allow_entities)    {    if (functionp(what)) return what; -  switch (what) { +  switch (upper_case(what)) {    case "ISO-10646-1":    case "ISO10646-1": -  +  case "ISO-10646": +  case "ISO10646":    return string_to_unicode;       case "UTF-8": -  +  case "UTF8":    return string_to_utf8;       default: