note
hexcoder
I interpret your question as "how do i change the hash key in a hash?"
<p>
If you can change the original hash, I suggest this code snippet, which deletes entries with the non-utf8 keys and reuses the values for the utf8-version key.
<c>
for (keys %oldhash) {
# change key and keep the value
$oldhash{utf8_on($_)} = delete $oldhash{$_};
}
call_pyfunc(\%oldhash);</c>
11136919
11136919