Skip to content

WASI: RFC 822 date parsing fails due to ICU dependency #115

@leogdion

Description

@leogdion

Problem

On WASI/WebAssembly, parsing RFC 822 date formats fails because DateFormatter requires ICU (International Components for Unicode) locale data to parse month abbreviations and day names. This data is limited or unavailable in WASM builds due to 256MB memory constraints.

Example

let dateDecoder = DateFormatterDecoder.RSS.decoder
let result = dateDecoder.decodeString("Fri, 06 Oct 2017 17:21:35 +0000")
// result is nil on WASI, but works on other platforms

Root Cause

The RFC 822 format string "E, d MMM yyyy HH:mm:ss zzz" includes:

  • E - Day name (e.g., "Fri")
  • MMM - Month abbreviation (e.g., "Oct")

Both require locale data from ICU to parse correctly.

Current Workaround

Test testDateDecoderRFC822 is skipped on WASI platform using XCTSkip.

Potential Solutions

  1. Custom FormatStyle (preferred): Create an RFC822FormatStyle that manually maps month abbreviations without ICU dependency
  2. Manual parser: Implement string parsing logic without DateFormatter
  3. Conditional compilation: Use different parsing strategy on WASI vs other platforms

References

  • Failing test: Tests/SyndiKitXCTests/WordpressTests.swift - testDateDecoderRFC822()
  • Date decoder: Sources/SyndiKit/Decoding/DateFormatterDecoder.swift
  • Real-world examples: Data/WordPress/articles.xml contains RSS feeds with RFC 822 dates

Impact

  • RSS feeds with RFC 822 pubDate fields cannot be parsed on WASI
  • WordPress export files use this format extensively
  • Other date formats (ISO 8601, WordPress numeric format) work fine on WASI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions