From a story where people no longer use keys for locks, but speak a special phrase into the lock:
それよりも、酒の勢いで、ついその文句を口に出してしまうことのほうが、しばしば発生した。しかし、帰ってから、酔いがさめて、後悔したりあわてたりする必要はない。内側から字を入れ替えて、別の文句になおせばいい。
On the other hand, people accidentally saying their phrase while drunk happens all the time. After coming home you sober up, but there's no need for regret or panic. From the inside you should replace the characters and fix to a different phrase.
I'm really confused by the sentence in bold. The story has been about people speaking these phrases. There is no mention of anything being written down or typed in. So what is the meaning of 字 here? I also don't really understand 文句になおす. Why is the particle に used instead of を?
その文句に
じゃなくて、「 別の 文句に直せばいい。」になってる。タイポちゃう?