http://qs1969.pair.com?node_id=11136963


in reply to How to convert hash keys to utf8

I interpret your question as "how do i change the hash key in a hash?"

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.

for (keys %oldhash) { # change key and keep the value $oldhash{utf8_on($_)} = delete $oldhash{$_}; } call_pyfunc(\%oldhash);