Description
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 commentedon May 16, 2012
Removed Type-Defect label.
Added Type-Enhancement, Area-Library, Triaged labels.
floitschG commentedon Aug 31, 2017
The
Encoding
class is used bydart:io
.The only thing missing is to add user-defined encodings to the
Encodings
map. This is covered by #12741 . Closing as a dupe.Roll Dart Documentation Generator from 8549817bb1b5 to f5bcc4bd46f4 (…