You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jakarta.apache.org by se...@apache.org on 2010/07/01 15:37:13 UTC
svn commit: r959653 -
/jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
Author: sebb
Date: Thu Jul 1 13:37:13 2010
New Revision: 959653
URL: http://svn.apache.org/viewvc?rev=959653&view=rev
Log:
handle charsets of the form: ContentType: text/plain; charset=ISO-8859-1; format=flowed
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java?rev=959653&r1=959652&r2=959653&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java Thu Jul 1 13:37:13 2010
@@ -552,7 +552,7 @@ public class SampleResult implements Ser
setDataEncoding(encodeUsing);
} catch (UnsupportedEncodingException e) {
log.warn("Could not convert string using '"+encodeUsing+
- "', using default encoding: "+DEFAULT_CHARSET+" "+e.getLocalizedMessage());
+ "', using default encoding: "+DEFAULT_CHARSET,e);
responseData = response.getBytes();
setDataEncoding(DEFAULT_CHARSET);
}
@@ -631,8 +631,12 @@ public class SampleResult implements Ser
final String CS_PFX = "charset="; // $NON-NLS-1$
int cset = ct.toLowerCase(java.util.Locale.ENGLISH).indexOf(CS_PFX);
if (cset >= 0) {
- // TODO - assumes charset is not followed by anything else
String charSet = ct.substring(cset + CS_PFX.length());
+ // handle: ContentType: text/plain; charset=ISO-8859-1; format=flowed
+ int semiColon = charSet.indexOf(';');
+ if (semiColon >= 0) {
+ charSet=charSet.substring(0, semiColon);
+ }
// Check for quoted string
if (charSet.startsWith("\"")){ // $NON-NLS-1$
setDataEncoding(charSet.substring(1, charSet.length()-1)); // remove quotes
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org