Skip to content

Diacritics and header encoding #85

Description

@rsdoiel

While the body sent from the browser can be UTF-8 the header has to be Latin1 to preserve the diacritics, RDM ran into this issue. I need to investigate and confirm this is why I cannot save the clpid records that have diacritics in the string.

Activity

  1. added this to the 0.1.0 milestone on Jul 31, 2025
  2. self-assigned this
    on Jul 31, 2025
  3. added
    bugSomething isn't working
    criticalThis options is preventing use of the application or will corrupted data.
    on Jul 31, 2025
  4. pinned this issue on Jan 29, 2026
  5. rsdoiel commented on Jan 29, 2026

    @rsdoiel
    MemberAuthor

    This will need to be integrated into the dataset upgrade fix since the internal API use run directly from datasetd.

  6. rsdoiel commented on Jan 29, 2026

    @rsdoiel
    MemberAuthor

    This is related to issue 80 too.

  7. rsdoiel commented on Apr 3, 2026

    @rsdoiel
    MemberAuthor

    This might be more complicated than the URL or header being ASCII and not UTF-8. Browsers send the UTF-8 correctly. That is because host names in IPv6 if not IPv4 can be UTF-8 (I get RSS feeds from host names that are in Japanese characters). When I was doing RegExp to create a validator function for clpid and clgid I ran into some really odd behaviors with some of our clpid and they might be the same ones that present a problem on saving the data. Needs much more investigation.

  8. modified the milestone: 0.1.0 on Apr 3, 2026
  9. rsdoiel commented on Apr 6, 2026

    @rsdoiel
    MemberAuthor

    Once we have a spec for clpid and clgid I can normalize the problematic identifiers and this will solve our problem. It's not the header ASCII encoding issue I thought it was.

  10. modified the milestones: 0.1.0, v0.0.40 release on Apr 6, 2026
  11. unpinned this issue on Apr 13, 2026
  12. pinned this issue on Sep 25, 2026
  13. rsdoiel commented on Sep 28, 2026

    @rsdoiel
    MemberAuthor

    Root cause confirmed, not the header-charset-declaration issue from the original comments: it is that HTTP header field values are restricted to the ByteString/Latin-1 range (RFC 7230 3.2.6), and every save handler (people, groups, journals, subjects, thesis_option, funders, doi_prefix) was putting the raw clpid/clgid/etc. straight into the redirect Location header.

    Two failure modes were present:

    • An identifier with any code point outside Latin-1 (0-255) made the Response constructor throw outright when the handler tried to build the redirect -- a hard save failure.
    • An identifier whose diacritics happen to sit inside Latin-1 (most common Western European accents) did not throw, but went out as a raw byte that is not valid UTF-8 -- silently wrong on the wire, which is why this was not showing up as a reproducible complaint recently.

    Fixed in be4c33f by encodeURIComponent()-ing the identifier before it becomes a header value, across all seven files that build a redirect Location. Verified this round-trips correctly back through the existing pathIdentifier()/decodeURI decode path. Covered by a new location_header_test.ts. Full suite (184+7 tests) still green.

    The separate clpid/clgid validator regex bug (rejects COVID-19, S2I-style identifiers with digits) turned out to be unrelated dead code and is filed as #114.

    Will ship in the next release.

  14. rsdoiel commented on Sep 28, 2026

    @rsdoiel
    MemberAuthor

    Closing per the fix in be4c33f, pushed to main. Will ship in the next release.

  15. added a commit that references this issue on Sep 28, 2026
    be4c33f
  16. unpinned this issue on Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcriticalThis options is preventing use of the application or will corrupted data.

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions