This obviously fell off my radar. We decided to go a different, but similar
route solving this in xquery as Saxon under eXist-db has the exact same
issue, so we need circumvention deeper down.
let $file-data := if (request:exists()) then (request:get-data())
else ()
let $update :=
if (not(empty($file-data))) then
(:Hack alert: upload fails when content has UTF-8 Byte Order Marker.
the UTF-8 representation of the BOM is the byte sequence
0xEF,0xBB,0xBF:)
let $file-content := util:base64-decode($file-data/content)
let $content-no-bom := if
(string-to-codepoints(substring($file-content,1,1))=65279) then
(substring($file-content,2)) else ($file-content)
let $store := xmldb:store($messageStoragePath,
encode-for-uri($filename), $content-no-bom)
else ()
--
View this message in context:
http://discuss.orbeon.com/UTF-8-with-BOM-not-supported-tp4656932p4658168.html