Skip to content

Use UTF-8 Encoding Without BOM by Default in All Serializers #827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

axunonb
Copy link
Collaborator

@axunonb axunonb commented Jun 26, 2025

Summary:
Changed the default encoding for all serializers to UTF-8 without BOM (new UTF8Encoding(false)). This ensures compatibility with iCalendar consumers that do not support BOM and provides consistent encoding across all serialization operations.

Affected serializers:
All serializers inheriting from SerializerBase, ComponentSerializer, EncodableDataTypeSerializer, or DataTypeSerializer now default to UTF-8 without BOM unless an explicit encoding is provided.

  • Directly from SerializerBase:

    • SimpleDeserializer
    • ComponentSerializer
    • DataMapSerializer
    • DataTypes.DataTypeSerializer
    • DataTypes.DateTimeSerializer
    • DataTypes.DurationSerializer
    • GenericListSerializer
    • ParameterSerializer
    • PropertySerializer
  • From ComponentSerializer:

    • CalendarSerializer
    • EventSerializer
    • SerializerFactory
  • From EncodableDataTypeSerializer or DataTypeSerializer:

    • DataTypes.AttachmentSerializer
    • DataTypes.EnumSerializer
    • DataTypes.GeographicLocationSerializer
    • DataTypes.IntegerSerializer
    • DataTypes.PeriodListSerializer
    • DataTypes.PeriodSerializer
    • DataTypes.RecurrencePatternSerializer
    • DataTypes.StringSerializer
    • DataTypes.UriSerializer
    • DataTypes.UtcOffsetSerializer
    • DataTypes.WeekDaySerializer

Rationale:
Ensures all iCalendar output is encoded in UTF-8 without BOM by default, as required by many consumers.

Resolves #823

Copy link

codecov bot commented Jun 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

❌ Your project check has failed because the head coverage (68%) is below the target coverage (80%). You can increase the head coverage or adjust the target coverage.

Impacted file tree graph

@@         Coverage Diff         @@
##           main   #827   +/-   ##
===================================
  Coverage    68%    68%           
===================================
  Files       106    106           
  Lines      4209   4210    +1     
  Branches    945    946    +1     
===================================
+ Hits       2842   2843    +1     
  Misses     1039   1039           
  Partials    328    328           
Files with missing lines Coverage Δ
Ical.Net/Serialization/SerializerBase.cs 53% <100%> (+2%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Summary:
Changed the default encoding for all serializers to UTF-8 without BOM (`new UTF8Encoding(false)`). This ensures compatibility with iCalendar consumers that do not support BOM and provides consistent encoding across all serialization operations.

Affected serializers:
All serializers inheriting from `SerializerBase`, `ComponentSerializer`, `EncodableDataTypeSerializer`, or `DataTypeSerializer` now default to UTF-8 without BOM unless an explicit encoding is provided.

- **Directly from `SerializerBase`:**
  - `SimpleDeserializer`
  - `ComponentSerializer`
  - `DataMapSerializer`
  - `DataTypes.DataTypeSerializer`
  - `DataTypes.DateTimeSerializer`
  - `DataTypes.DurationSerializer`
  - `GenericListSerializer`
  - `ParameterSerializer`
  - `PropertySerializer`

- **From `ComponentSerializer`:**
  - `CalendarSerializer`
  - `EventSerializer`
  - `SerializerFactory`

- **From `EncodableDataTypeSerializer` or `DataTypeSerializer`:**
  - `DataTypes.AttachmentSerializer`
  - `DataTypes.EnumSerializer`
  - `DataTypes.GeographicLocationSerializer`
  - `DataTypes.IntegerSerializer`
  - `DataTypes.PeriodListSerializer`
  - `DataTypes.PeriodSerializer`
  - `DataTypes.RecurrencePatternSerializer`
  - `DataTypes.StringSerializer`
  - `DataTypes.UriSerializer`
  - `DataTypes.UtcOffsetSerializer`
  - `DataTypes.WeekDaySerializer`

**Rationale:**
Ensures all iCalendar output is encoded in UTF-8 without BOM by default, as required by many consumers.
@axunonb axunonb force-pushed the wip/axunonb/pr/utf8-no-bom branch from 6aee7a2 to 877568c Compare June 26, 2025 20:02
@axunonb axunonb requested a review from minichma June 26, 2025 20:04
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iCalendar UTF8 Encoding with/without BOM
1 participant