Skip to content

Request for API enhancements to handle character encodings other than UTF-8 #3058

Closed
@DartBot

Description

@DartBot

This issue was originally filed by TerryMit...@gmail.com


Following to the comment 4 of previous bug (http://code.google.com/p/dart/issues/detail?id=2902), I am opening a new bug on the Shift_JIS encoding.

1:
Chrome says “accept-charset: Shift_JIS,utf-8;q=0.7,*;q=0.3” in its request header. Character set Shift_JIS (Windows-31J) is a commonly used encoding in Japan other than UTF-8. I would suggest Dart team to include Shift_JIS to the Encoding class in the near future.

2:
In order to retrieve Shift_JIS encoded request parameters from the browser, we need some kind of code converters. In case of servlet, we usually retrieve request parameters using method and constructor of class String like:
new String(request.getParameterValues(name)[i].getBytes("8859_1"), "Windows-31J")
The current dart:core.String interface does not have such method and constructor for code conversion.

3:
We also need urlEncode(String, [encoding]) and urlDecode(String, [encoding]) methods like java.net.URLEncoder.encode and java.net.URLDecoder.decode. Default value of the formal parameter encoding is UTF-8. Function urlDecode will be used to decode URL encoded POST body data. Default enctype of HTML Form is “application/x-www-form-urlencoded”. Function urlEncode will be used to generate cookie header data.

4:
Another choice would be to remove the Encoding class and all methods having formal parameter encoding from dart:io library. I am not sure how much the impact of insisting UTF-8 on penetration into Asian markets. It’s up to your company’s global strategy.

Activity

sethladd

sethladd commented on May 16, 2012

@sethladd
Contributor

Removed Type-Defect label.
Added Type-Enhancement, Area-Library, Triaged labels.

added
P2A bug or feature request we're likely to work on
type-enhancementA request for a change that isn't a bug
and removed on Feb 29, 2016
floitschG

floitschG commented on Aug 31, 2017

@floitschG
Contributor

The Encoding class is used by dart:io.

The only thing missing is to add user-defined encodings to the Encodings map. This is covered by #12741 . Closing as a dupe.

added
closed-duplicateClosed in favor of an existing report
and removed on Aug 31, 2017
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

    P2A bug or feature request we're likely to work onarea-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.closed-duplicateClosed in favor of an existing reporttype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sethladd@kevmoo@lrhn@floitschG@DartBot

        Issue actions

          Request for API enhancements to handle character encodings other than UTF-8 · Issue #3058 · dart-lang/sdk