my %newhash; for (keys %oldhash) { $newhash{utf8_on($_)} = $newhash{$_}; } call_pyfunc(\%newhash);