Fix parameter for hostname-change

1. Send parameter as string rather than list.
2. If the new hostname is a unicode string but valid (containing only ASCII characters), then convert to ASCII string.