[MPLUGIN-94] Use correct encoding for plugin descriptor

Submitted by: Benjamin Bentmann

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@643339 13f79535-47bb-0310-9956-ffa450edef68
master
Herve Boutemy 2008-04-01 09:45:55 +00:00
parent d0bf52036b
commit 5db1b14327
1 changed files with 8 additions and 4 deletions

View File

@ -30,8 +30,10 @@ import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
import org.codehaus.plexus.util.xml.XMLWriter; import org.codehaus.plexus.util.xml.XMLWriter;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
@ -53,6 +55,8 @@ public class PluginDescriptorGenerator
public void execute( File destinationDirectory, PluginDescriptor pluginDescriptor ) public void execute( File destinationDirectory, PluginDescriptor pluginDescriptor )
throws IOException throws IOException
{ {
String encoding = "UTF-8";
File f = new File( destinationDirectory, "plugin.xml" ); File f = new File( destinationDirectory, "plugin.xml" );
if ( !f.getParentFile().exists() ) if ( !f.getParentFile().exists() )
@ -60,12 +64,12 @@ public class PluginDescriptorGenerator
f.getParentFile().mkdirs(); f.getParentFile().mkdirs();
} }
FileWriter writer = null; Writer writer = null;
try try
{ {
writer = new FileWriter( f ); writer = new OutputStreamWriter( new FileOutputStream( f ), encoding );
XMLWriter w = new PrettyPrintXMLWriter( writer ); XMLWriter w = new PrettyPrintXMLWriter( writer, encoding, null );
w.startElement( "plugin" ); w.startElement( "plugin" );