this of course depends on what the tool that you use to encrypt the pdf (acrobat reader etc) does with the input. It could use utf-8 by default. it could use utf16-le etc...
The linux echo tool wont change the encoding and therefore the default encoding of your shell is used (probably utf-8 since d985 is the utf-8 version of م)
Therefore you can't really compare a simple echo with what the pdf tool does. It could use different encodings if the chars are outside the ASCII space. There are many possibilities but only a small amount of encodings are used in the wild (the most common are of course utf8, utf16 and utf32 variants).
The linux echo tool wont change the encoding and therefore the default encoding of your shell is used (probably utf-8 since d985 is the utf-8 version of م)
Therefore you can't really compare a simple echo with what the pdf tool does. It could use different encodings if the chars are outside the ASCII space. There are many possibilities but only a small amount of encodings are used in the wild (the most common are of course utf8, utf16 and utf32 variants).