Issue 4592 (6179/6187/6308)  IDN support Part 2

This is not tested and will have errors.
The changes - draft - have to be corrected by somebody who has a development environment.

But most of the changes to implement IDN support should be done by now.