You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The liberator.conneg/best-allowed-charset function contains an "or" expression in which the 3rd clause explicitly tests for "iso-8859-1" (and returning a quality value of 1), and this is causing some trouble.
For example, if I have a request with an "Accept-Charset" value of: "ISO-2022-CN", best-allowed-charset returns "ISO-8859-1". But if I have request with value: "UTF-8", best-allowed-charset returns "UTF-8". This is because "UTF-8" appears after "ISO-8859-1" from a lexicographic sort order, and since the 'select-best' function does a sort, reverse, first, UTF-8 is returned. But for ISO-2022-CN, ISO-8859-1 is returned.
FYI, (best-allowed-charset "ISO-2022-CN;q=1,ISO-8859-1;q=0.8") correctly returns ISO-2022-CN because 'select-best' does the sort based on the parsed quality number first.
I feel the solution is simply to remove the explicit 3rd clause of the aforementioned 'best-allowed-charset' function; I just don't see why an explicit clause should be there for the "ISO-8859-1" charset.