I have searched throughout the site but I think I have a slightly different issue and could really do with some help before I either have heart failure or burn the computer.
我生动地提出每月名单(以2011年6月、2011年7月的形式),我显然希望这份名单具有地方敏感性:因此,我使用简单的日期格式反对如下:
//the actual locale name is dependent on UI selection
Locale localeObject=new Locale("pl");
// intended to return full month name - in local language.
DateFormat dtFormat = new SimpleDateFormat("MMMM yyyy",localeObject);
//this bit just sets up a calendar (used for other bits but here to illustrate the issue
String systemTimeZoneName = "GMT";
TimeZone systemTimeZone=TimeZone.getTimeZone(systemTimeZoneName);
Calendar mCal = new GregorianCalendar(systemTimeZone); //"gmt" time
mCal.getTime(); //current date and time
但是,如果我这样做的话:
String value=dtFormat.format(mCal.getTime());
this "should" return the localized version of the month name. In polish the word "September" is "Wrzesień" -- note the accent on the n. However all I get back is "Wrzesie?"
我做了什么错误?
由于大家——现在我接受,它是一个介绍问题——但我如何能够安全地“阅读”地通过 d子产生的结果——我在下文加上一些评论,在其它情况下这样做——我似乎可以不夸张地取得明显的结果。
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The answer was on BalusC s blog : http://balusc.blogspot.com/2009/05/unicode-how-to-get-characters-right.html#DevelopmentEnvironment
基本上,DTformat物体正在返回UTF-8,正被自动转变为系统缺省特性,而当时我把它看成一个扼杀装置。
因此,这部法典对我工作。
new String(dtFormat.format(mCal.getTime()).getBytes("UTF-8"),"ISO-8859-1");
非常感谢您的援助。