Users of a programming language expect string functions to do only what was specified. They are not supposed to process codes or discard characters. This would cause lots of complains and hard to find errors.

The obvious solution to your problem is writing a function to be applied to strings, which processes your UCS-2 code and deletes its control characters.