Request for API enhancements to handle character encodings other than UTF-8 #3058
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
closed-duplicate
Closed in favor of an existing report
P2
A bug or feature request we're likely to work on
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by [email protected]
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.
The text was updated successfully, but these errors were encountered: