Skip to content

bin:decode-string: Interpretation of $encoding argument #2217

Closed

Description

@ChristianGruen

When the $encoding argument for bin:decode-string is omitted, the utf-8 encoding is assumed.

I propose to change the function signature to…

bin:decode-string(
  $in        as (xs:hexBinary | xs:base64Binary)?,	
  $encoding  as xs:string?                         := ()   (: before: 'utf-8' :)
  $offset    as xs:integer?                        := 0,
  $size      as xs:integer?                        := ()
) as xs:string?

…try to interpret the first read bytes as byte order mark and, if no BOM is found, assume UTF-8.

As a result, both bin:decode-string(xs:hexBinary('41')) and bin:decode-string(xs:hexBinary('EFBBBF41')) would return A.

Activity

  1. added
    EnhancementA change or improvement to an existing feature
    EXPathAn issue related to the EXPath extension functions
    on Sep 29, 2025
  2. changed the title [-]`bin:decode-string`: Interpretation of missing `$encoding` argument[/-] [+]`bin:decode-string`: Interpretation of `$encoding` argument[/+] on Sep 30, 2025
  3. added a commit that references this issue on Oct 2, 2025
    2d3f3d4
  4. removed their assignment
    on Oct 2, 2025
  5. added a commit that references this issue on Oct 27, 2025
    07a18a0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EXPathAn issue related to the EXPath extension functionsEnhancementA change or improvement to an existing featurePR PendingA PR has been raised to resolve this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions