Menu

#8 backslash disapears in text

open
nobody
None
5
2004-10-27
2004-10-27
Vincent G.
No

backslash disapears in text.

Suggested patch: replace each backslash '\' (which is
"\\" in java) with two backslashes '\\' (which is
"\\\\" in java).

before:
---PDFStringHelper.java---
public static String makePDFString(String s) {
if(s.indexOf("(")>-1)
s = replace(s,"(","\\(");

if(s.indexOf(")")>-1)
s = replace(s,")","\\)");

return "("+s+")";
}
-----------

after
---PDFStringHelper.java---
public static String makePDFString(String s) {
if(s.indexOf("\\")>-1)
s = replace(s,"\\","\\\\");

if(s.indexOf("(")>-1)
s = replace(s,"(","\\(");

if(s.indexOf(")")>-1)
s = replace(s,")","\\)");

return "("+s+")";
}
-----------

Discussion


Log in to post a comment.