I am looking for a robust way in Java to test if a text fragment is quoted-printable encoded. The most straightforward way would be to test whether a string contains char sequences which match the following regular expression: (=[A–F0-9][A–F0-9])|(=[\r][\n]) (encoded characters + = and soft break for a newline).
I am looking for a robust way in Java to test if a text
Share
I would negate the test; text which contains = followed by anything other than newline or two hex digits is not QP; but this is still a weak heuristic – somebody could put
=3Din unencoded text just for the heck of it (and I just did). Bottom line: if you don’t know the encoding, you don’t know the encoding.