Hello.
Some programming languages have support for strings, that are stored as folows:
For example, AnsiString type in Delphi. These strings are conveniently managed and one can think, that it is a good idea to use them as a container for binary data since there are some effective operations on concatenation, substring extraction etc.
Somehow I have a strong feeling, that using string type, even if it is binary safe, for storing binary data is ideologically wrong, but I can't find any strong arguments to defend this position.
For sure, in such languages as PHP where using arrays actually add tooo much overhead (each array member in PHP occupies about 50 bytes of memory because of hashed nature of arrays) you have no other option than to use strings as binary data containers. But as for Delphi or C++ (with it's std::string) I think that storing binary data in strings (for example, cipher encryption keys or any binary protocol buffer) is wrong if even you have technical possibility to do that.
What do you think? Is there any arguments against storing binary data in strings?