closes #12967 fix [en|de]coding of HashMap<K,V> where K is a numeric type

serialize: ref #12697 minor adj. to last char check + prettyencode test