2

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?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175

1 Answers1

3

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
        <LF>

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:

Thomas Dickey
  • 75,040
  • 9
  • 171
  • 268