Skip to content

Sample files are loaded as Latin-1, breaking non-ASCII characters #3121

Open
@mernen

Description

@mernen

What happened?

DartPad uses Latin-1 when parsing samples from the Flutter repository, even though they are UTF-8. This is likely because the server returns a content-type: application/vnd.dart header with no charset, and DartPad uses package:http, which defaults to Latin-1:

https://github.com/dart-lang/http/blob/7f50fc5b3d74a3031833226d93301b41593e2e61/pkgs/http/lib/src/response.dart#L20-L28

Steps to reproduce problem

  1. Visit the following Flutter sample: https://dartpad.dev/?sample_id=rendering.BoxParentData.1&channel=stable&run=true
  2. Check the third headline in the source code or running example, which should read "Bugs with greater impact on developers are more valuable (maximize ΔH)"
  3. Notice it ends with "(maximize �H)" instead

Additional info

Here's a direct link to the line in the sample code that exposes the issue:

https://github.com/flutter/flutter/blob/5517cc9b3b3bcf12431b47f495e342a30b738835/examples/api/lib/rendering/box/parent_data.0.dart#L49C15-L49C85

Browser

Browser: tested on Chrome and Safari for macOS

Version: Chrome 131.0.6778.265, Safari 18.2

Are you using any extensions/plugins that affect website behavior
(particularly those that affect iframes, such as ad blockers)? No

Are there any warnings or errors in your browser's JavaScript console?
If so, paste them below:

All logs appear to be typical for DartPad and unrelated to this issue

Machine

Operating system: macOS

Version: 14.7.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions