[tbnl-devel] Content length with multibyte character encodings

Ignas Mikalajunas ignas.mikalajunas at gmail.com
Mon Nov 28 22:18:08 UTC 2005


  Content length is calculated by calling (length content) which
produces wrong results with unicode characters in the string. Piso on
#lisp proposed a solution - using (length (string-to-octets string
:external-format :utf-8)) which translates to just (length
(string-to-octets string :external-format)) in the code.
  The true way to solve this would be using (file-string-length), but
the function is not working properly on sbcl yet. So could you please
fix the (send-output), because with current setup browsers that
strictly adhere to the content-lenght (IE 6.0, Opera) would trim 1
character of the responses body for each UTF-8 character in it.
   Ignas



More information about the Tbnl-devel mailing list