We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

I am try to replace string Containing � character aspose

String appSID = "*******************************";
String appKey = "*******************************";
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//specify product URI
//sepcify App SID
//sepcify App Key
String fileName = "bug.docx";
String outputPath = "c:\\test\\bug.doc";
String oldText = "We apologize for the delay. And we hope you understand the reason: We will never deliver you a sub-par product—digital or otherwise— because you deserve the very best.";
String newText = "Hashmat Ullah Khattak";

//create DocumentBuilder object
DocumentBuilder builder = new DocumentBuilder();
//Replace a text with new value into the document
builder.replaceText(fileName, oldText.trim(), newText, true, false, outputPath);
catch (Exception ex)
Following Exception is thrown by Api when i remove the mention character it working working fine..

java.io.IOException: too many bytes written
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3179) at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3179)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implClose(StreamEncoder.java:316)
at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:149)
at java.io.OutputStreamWriter.close(OutputStreamWriter.java:233)
at com.aspose.cloud.common.Utils.ProcessCommand(Utils.java:239)
at com.aspose.cloud.words.DocumentBuilder.replaceText(DocumentBuilder.java:153)
at characterissue.CharacterIssue.main(CharacterIssue.java:56)
at java.io.Reader.(Reader.java:78)
at java.io.InputStreamReader.(InputStreamReader.java:72)
at com.aspose.cloud.common.Utils.StreamToString(Utils.java:339)
at com.aspose.cloud.words.DocumentBuilder.replaceText(DocumentBuilder.java:155)
at characterissue.CharacterIssue.main(CharacterIssue.java:56)
at com.aspose.cloud.words.DocumentBuilder.replaceText(DocumentBuilder.java:162)
at characterissue.CharacterIssue.main(CharacterIssue.java:56)

Hi Hashmat,

Thanks for your inquiry. I have tested the scenario and have not found the shared issue. Could you please try again the same scenario and let us know if you still face problem? Please make sure that you are using the same document.

Yeah Sir Im Using Same file But Im Still facing a problem can you send me the output file and code that you have Used for Testing…??

Hi Hashmat,

Thanks for your inquiry. I tested the scenario using Aspose Cloud SDK for .NET and have not found any issue. We are checking this scenario using Aspose Cloud SDK for Java and will update you asap.

Hi Hashmat,

Thanks for your patience. I have tested the scenario and have
managed to reproduce the same issue at my side. For the sake of
correction, I have logged this problem in our issue tracking system as SAWEB-40. We will update you via this forum thread once this issue is

We apologize for your inconvenience.