Does anyone know which character encoding is used in .netrc? As a German user, I sometimes put umlauts in passwords.

So my question is, are these treated as latin1 or may I assume that I am doing fine encoding the file in UTF-8?


There's no applicable standard for .netrc, which started off in the 1980s as a BSD feature. That of course predates UTF-8. However, since there are no standards, you may be using someone's "improvement" which assumes (a) locale-based encoding or (b) UTF-8. Don't count on it.

The password used for ftp is covered by an RFC (again, predating UTF-8), and says the content is ASCII. In section 5.3.2, the relevant part of the BNF is

        <password> ::= <string>
        <string> ::= <char> | <char><string>
        <char> ::= any of the 128 ASCII characters except <CR> and

The later RFCs build on RFC 959, but don't change the rules. However, implementers stretch things, so you're able to use Latin1.

Further reading:

  • Thank you Thomas for listing all these references. So ASCII is all I can assume here. – Mirko Friedenhagen Aug 6 '16 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.