I'm Spanish, n and ñ are different letters. They are not substitutes. It is the difference between someone being 5 years old and someone having 5 anuses.
For people on Linux, enable the compose key in your keyboard settings and then type [Compose] [n] [~].
The compose-key method for entering accented letters is by far the easiest to use for any desktop OS ... but it's not enabled by default because you have to give up some modifier key to use it.
It's completely off-topic but Compose is amazing. Specially as you can actually customise it for your usage, with a .XCompose file. For me it's the only think that makes phonetic transcription flow, otherwise you got to shift layouts back and forth to write something like "[tɾɐ̃skɾi'sɜ̃ʊ̯] ⟨transcrição⟩".
Based solely off this comment, I just wanna say you seem like such a cool person. Anyone who has a custom file on their OS to facilitate using IPA characters is good people in my book.
On windows, hold 'alt' and then type the numbers 1 6 4 for lower case and 1 6 5 for upper case ñ.
That's their places in the ASCII table, you can do that with any special characters, look up their place in the ASCII table, press alt and the respecting number, release alt and voila.
Be happy that it doesn't: brazilian keyboards added an extra key for "ç" right in the middle of the keyboard and it's pretty useful, until the day you have to use any other keyboard and realize that if you configure it to use the brazilian layout, you're not losing the "ç", you lose the comma, or question mark, or exclamation mark or something much more annoying to be left without.
Now you either learn to type again with another keyboard layout, or spend the rest of your life using only cheap keyboards made in brazil that have the "right amount" of keys.