I have a password with - in it, and never had the problems you got.
# makes sense because that uncomments code in yml files, from anywhere in the line: Comments begin with the number sign ( # ), can start anywhere on a line, and continue until the end of the line (YAML - Wikipedia).