No luck with you code

[XPTY0004] Binary expected, xs:string found.



On Sun, Jun 12, 2016 at 10:50 PM, Christian Grün <christian.gruen@gmail.com> wrote:
> I've tried it, it works. Almost fine. Now I have an issue with encoding.
> Seems like 'encoding' parameter was not applied
>
> let $csv := csv:parse($csv, map{ 'separator': ';', 'header': false(),
> 'encoding': 'CP1251' } )

This should work:

  declare
    %rest:path("/upload")
    %rest:POST("{$body}")
    function local:store-csv($body)
  {
    let $string := convert:binary-to-string($body, 'CP1251')
    return csv:parse($string, map{ 'separator': ';', 'header': false(),
  };



--
s0rr0w