Remove { { '=', '0', 'A' }, { '\n' } } from translationTable with
EscapableStringTokenizer class and QUOTED-PRINTABLE will
not be "destroyed" wiht a replacing linebreak by the parser.
hopefully this char-set is not neede anywhere else ...
it works fine for me so far
daniel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am in the process of creating version 2.0 of the utility
that uses vCard4j, and I suspected I might need to enhance
it a bit.
Here is the function:
static final String convertQuotedPrintableNewLines(String
input){
// using buffers to properly reconstruct the String
// Windows Style new line
String compareString = new String("=0D=0A");
int compareLength = compareString.length();
CharArrayReader inReader = new
CharArrayReader(input.toCharArray());
CharArrayWriter outWriter = new CharArrayWriter();
CharArrayWriter outWriterInner = new CharArrayWriter();
BufferedWriter outBuff = new BufferedWriter(outWriter);
StringBuffer tempStringBuff = new StringBuffer();
// this is very much in 'C' style *shrug*
int nChar, nCharInner, counter;
try{
while((nChar = inReader.read()) != -1){
if(nChar == '='){
// read the next characters if possible
counter = 1; //have one already
outWriterInner.reset();
outWriterInner.write((char)nChar);
while((nCharInner = inReader.read()) != -1){
counter++;
outWriterInner.write((char)nCharInner);
if(counter == compareLength){ // 6
characters total
Logged In: NO
Remove { { '=', '0', 'A' }, { '\n' } } from translationTable with
EscapableStringTokenizer class and QUOTED-PRINTABLE will
not be "destroyed" wiht a replacing linebreak by the parser.
hopefully this char-set is not neede anywhere else ...
it works fine for me so far
daniel
Logged In: YES
user_id=905575
I had that same problem in my vCard to LDIF utility. I
created a function to replace those characters with proper
new lines.
The utility is at http://mills.zapto.org/projects/vcf2ldif
I am in the process of creating version 2.0 of the utility
that uses vCard4j, and I suspected I might need to enhance
it a bit.
Here is the function:
static final String convertQuotedPrintableNewLines(String
input){
// using buffers to properly reconstruct the String
// Windows Style new line
String compareString = new String("=0D=0A");
int compareLength = compareString.length();
CharArrayReader inReader = new
CharArrayReader(input.toCharArray());
CharArrayWriter outWriter = new CharArrayWriter();
CharArrayWriter outWriterInner = new CharArrayWriter();
BufferedWriter outBuff = new BufferedWriter(outWriter);
StringBuffer tempStringBuff = new StringBuffer();
// this is very much in 'C' style *shrug*
int nChar, nCharInner, counter;
try{
while((nChar = inReader.read()) != -1){
if(nChar == '='){
// read the next characters if possible
counter = 1; //have one already
outWriterInner.reset();
outWriterInner.write((char)nChar);
while((nCharInner = inReader.read()) != -1){
counter++;
outWriterInner.write((char)nCharInner);
if(counter == compareLength){ // 6
characters total
outWriterInner.flush();
if(compareString.equals(outWriterInner.toString())){
outBuff.write("\n");
}else {
outBuff.write(outWriterInner.toCharArray());
}
break; //exit out of inner loop
}
}if(nCharInner == -1){ // end of stream case
outWriterInner.flush();
outBuff.write(outWriterInner.toCharArray());
}
}else { //just a regular character
outBuff.write((char)nChar);
}
}
outBuff.flush();
}catch(IOException e){
}
return outWriter.toString();
}