I assume you mean encryption when you say "encoding".
This model of attack is known as the known-plaintext attack. It is a situation where an attacker has samples of both the encrypted ciphertext and the corresponding plaintext. All commonly used encryption schemes thought to be secure are resistant against this form of attack (resistant meaning there is no better method than a naive bruteforce attack on the key).
In fact, most modern symmetric ciphers are secure against a much stronger model of attack, the chosen-plaintext attack where an attacker has the ability to encrypt arbitrary amounts of plaintext data and obtain the corresponding ciphertext.
So the answer to this is no, you are very wrong, at least when referring to encryption schemes that you should be using in real world situations.