From b2fd48501bf49caef7f721944484dfe3bad2387f Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Fri, 11 May 2007 07:00:46 +0000 Subject: [PATCH] Fixed default encoding problem. Submitted by: Jelka Kosir Note by jeremias: I haven't found any information which encoding/charset should be used with basic authentication. RFC 2617 doesn't seem to address that. The behaviour for characters outside the US-ASCII (7bit) charset may not be as expected. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@537120 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/apps/FOURIResolver.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/fop/apps/FOURIResolver.java b/src/java/org/apache/fop/apps/FOURIResolver.java index 5b66ffa57..e3ffd22cc 100644 --- a/src/java/org/apache/fop/apps/FOURIResolver.java +++ b/src/java/org/apache/fop/apps/FOURIResolver.java @@ -189,10 +189,11 @@ public class FOURIResolver try { ByteArrayOutputStream baout = new ByteArrayOutputStream(combined.length() * 2); Base64EncodeStream base64 = new Base64EncodeStream(baout); - base64.write(combined.getBytes()); + //TODO Not sure what charset/encoding can be used with basic authentication + base64.write(combined.getBytes("UTF-8")); base64.close(); connection.setRequestProperty("Authorization", - "Basic " + new String(baout.toByteArray())); + "Basic " + new String(baout.toByteArray(), "UTF-8")); } catch (IOException e) { //won't happen. We're operating in-memory. throw new RuntimeException("Error during base64 encodation of username/password"); -- 2.39.5