Author: tfmorris Date: 2008-11-14 12:10:17-0800 New Revision: 16049 Modified: trunk/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java
Log: Issue 5434 - Use application encoding (UTF-8) instead of default platform encoding when writing Modified: trunk/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java?view=diff&rev=16049&p1=trunk/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java&p2=trunk/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java&r1=16048&r2=16049 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java (original) +++ trunk/src/argouml-app/src/org/argouml/persistence/DiagramMemberFilePersister.java 2008-11-14 12:10:17-0800 @@ -1,5 +1,5 @@ // $Id$ -// Copyright (c) 1996-2006 The Regents of the University of California. All +// Copyright (c) 1996-2008 The Regents of the University of California. All // Rights Reserved. Permission to use, copy, modify, and distribute this // software and its documentation without fee, and without a written // agreement is hereby granted, provided that the above copyright notice @@ -29,10 +29,13 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.OutputStreamWriter; import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; import java.io.Writer; import java.net.URL; +import org.argouml.application.api.Argo; import org.argouml.kernel.Project; import org.argouml.kernel.ProjectMember; import org.argouml.uml.diagram.ProjectMemberDiagram; @@ -138,14 +141,21 @@ } catch (ExpansionException e) { throw new SaveException(e); } - PrintWriter pw = new PrintWriter(outStream); + OutputStreamWriter outputWriter; + try { + outputWriter = + new OutputStreamWriter(outStream, Argo.getEncoding()); + } catch (UnsupportedEncodingException e1) { + throw new SaveException("Bad encoding", e1); + } + PrintWriter printWriter = new PrintWriter(outputWriter); try { // WARNING: the OutputStream version of this doesn't work! - tfm - expander.expand(pw, diagramMember.getDiagram()); + expander.expand(printWriter, diagramMember.getDiagram()); } catch (ExpansionException e) { throw new SaveException(e); } finally { - pw.flush(); + printWriter.flush(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
