You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/07/22 17:06:27 UTC
DO NOT REPLY [Bug 21800] New: -
because The OutputStreamWriter not flush, so short String will encoded error...
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21800>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21800
because The OutputStreamWriter not flush, so short String will encoded error...
Summary: because The OutputStreamWriter not flush, so short
String will encoded error...
Product: Commons
Version: Nightly Builds
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Codec
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: cn_liujie@yahoo.com.cn
because The OutputStreamWriter not flush, so short String will encoded error...
org.apache.commons.codec.base64 bug, i coreect,anyone can notify the committer
public static String encode(String data, String
charEncoding)
throws UnsupportedEncodingException {
// Check arguments
if (data == null) {
data = "";
}
if (charEncoding == null) {
charEncoding = DEFAULT_CHAR_ENCODING;
}
// Convert to byte[]
ByteArrayOutputStream bos = new
ByteArrayOutputStream();
OutputStreamWriter osw = new
OutputStreamWriter(bos, charEncoding);
try {
osw.write(data);
//*****should add start*********
osw.flush()
//*****should add end*********
} catch (IOException ioe) {
throw new
RuntimeException(ioe.toString());
}
// Encode
byte[] encodedData =
encode(bos.toByteArray());
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org