Index: contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/FileImportCommand.java =================================================================== --- contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/FileImportCommand.java (revision 240307) +++ contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/FileImportCommand.java (working copy) @@ -19,6 +19,7 @@ import javax.jcr.Node; import java.io.InputStream; import java.util.Calendar; +import org.apache.log4j.Logger; /** * This Class implements an import command that creates a "nt:resource" node or @@ -26,11 +27,13 @@ * data as binary property. It further sets the following properties: *
null if the parameter is not
+ * included.
+ */
+ protected String parseContentCharset(String contentType) {
+ if (contentType == null) {
+ return null;
+ }
+ // find the charset parameter
+ int equal = contentType.indexOf("charset=");
+ if (equal == -1) {
+ return null;
+ }
+ String charset = contentType.substring(equal + 8);
+ // get rid of any other parameters that might be specified
+ // after the charset
+ int semi = charset.indexOf(";");
+ if (semi != -1) {
+ charset = charset.substring(0, semi);
+ }
+ // strip off enclosing quotes
+ if (charset.startsWith("\"") || charset.startsWith("'")) {
+ charset = charset.substring(1, charset.length() - 1);
+ }
+ return charset;
+ }
}