try to flush! 在 2012年3月29日 下午3:25,Dirk Vranckaert <dirkvrancka...@gmail.com>写道:
> In my application users can export their data (or a subset of it) to a CSV > file (to be used in Excel or any other spreadsheet app). > However some of my users are reporting that if they export some that > contains non-western characters (like chinese or hebrew writings) the text > is not correctly in the export. > > When I try this myself I indeed see that the text is not correct. Here is > the code that writes the content to the file (UTF-8 encoded). > > Writer out = null; > try { > out = new BufferedWriter(new OutputStreamWriter( > new FileOutputStream(file), "UTF-8" > )); > out.write(result.toString()); > } catch (UnsupportedEncodingException e) { > Log.e(LOG_TAG, "The encoding is not supported!", e); > } catch (FileNotFoundException e) { > Log.e(LOG_TAG, "The file is not found", e); > } catch (IOException e) { > Log.e(LOG_TAG, "Exception occurred during export...", e); > } finally { > if (out != null) { > try { > out.close(); > } catch (IOException e) { > Log.e(LOG_TAG, "Could not close the writer", e); > } > } > } > > Is there anything else that I can do to optimize my code to support those > languages? > > Kr, > > Dirk Vranckaert > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en