fix recodeAdditionalChars
encode empty string as flag field
move mergeID out of loop to prevent extraneous calls