I realized all this because of the use of 'echo' in the Windows terminal
once I used Perl to write the pwd.txt file, everything went fine ... no surprise, no added extra characters
the file generated by the echo command had a BOM invisible character at the start, FF FE and 00 every second character because UTF-16 requires two code units to represent a single character.
surprise, surprise