fix enterprise support, fix encoding issues

* was not working consistently
* also had trouble with unicode<>string issues