@JosAH
Yes, I know.
It's just an expert-trick if you have problems with database specific issues like special characters or trimming:
- if your database can only store ascii-characters (or you don't know / have no rights to configure it to UTF-8), but you need to store some language-specific non-ascii-characters.
- if your database trims leading / trailing whitespaces (or appends some to fill for max-length) according to the column field type, but you want to preserve them. (space --> plus-sign)
- if you don't care how the data looks inside the database, but you care that it is 100% the same before encoding and after retrieving and decoding
You could also use xml encoding/decoding, but the issue with whitespace (cr/lf/tab/space, 0x00-0x1F) remains.