on 04-25-2007 8:51 AM
1)
byte[] message=outMail.getMessage();
String msg=new String(message,"UTF-8");
System.out.println("msg");
String have limited size();
if i want to change to StringBuffer..how do i encode this....
StringBuffer sb = new StringBuffer();
2)
byte[] message=outMail.getMessage();
String msg=new String(message,"UTF-8");
inputTable.setValue(msg,"CONTE");
when i set my content to "cba" it will come with ######### at behind
when i return my result to the JCO....
it will be like this
Content: cba ######################
yzme,
1. Create String first as you do, then use StringBuffer sb = new StringBuffer(msg);
2. Seems that you are using wrong byte encoding, i.e. the content of message is not UTF-8 encoded.
Valery Silaev
SaM Solutions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for instance i receive from JCO...
if (input2.getNumRows() > 0) {
for (int i = 0; i < input2.getNumRows(); i++) {
input2.setRow(i);
strContent.append(input2.getString("CONTE")).append("rn");
}
System.err.println(strContent.toString());
}
//store it in bytes in db
outMailBean.setMessage(strContent.toString().getBytes());
after that i will parse to jco after successful send the mail...
byte[] message=outMailBean.getMessage();
String msg=new String(message,"ISO-8859-1");
StringBuffer sb=new StringBuffer(msg);
how stringbuffer going to separates into several lines using last index of to determines the line of content...
Table structure
emailid lineno content
1001 1 hallo
1001 2 how r u
yzme,
<i>how stringbuffer going to separates into several lines using last index of to determines the line of content...</i>
No offence -- but could you repeat this in English?
Also make sure that you are using same encoding with <i>strContent.toString().getBytes()</i> and <i>String msg=new String(message,"ISO-8859-1")</i>. In your case use getBytes("ISO-8859-1")
VS
1)
String msg=new String(message,"UTF-8") is wrong
you telling me that
should be
String msg=new String(message,"ISO-8859-1")
izzit...
2)
previously i do like this
sb.append("hallo \r\n");
sb.append("you there \r\n");
strContent = sb.toString().getBytes("ISO-8859");
sb will parse to another method for further processing...
if i have a StringBuffer
how do i break it into several lines when it meet '\r\n'
possible ??
TLINENO Content
1 Hallo
2 You there
Message was edited by:
yzme yzme
Message was edited by:
yzme yzme
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.