canada
Will courts interpret words to mean the opposite of what they actually mean if that is clearly the author's intent?
A lot of work is being done by the word "actually" in your question. Under the modern approach to statutory interpretation, a word does not have an "actual" meaning outside of the context of its use.
The "modern approach" to interpretation
Under the purposive approach (also called the "modern principle" or "modern approach"):
the words of an Act are to be read in their entire context and their grammatical and ordinary sense harmoniously with the scheme of the Act, the object of the Act, and the intention of Parliament.
Rizzo & Rizzo Shoes Ltd. (Re), [1998] 1 S.C.R. 27, para. 21.
"The ordinary meaning is not the same as the dictionary definition, as the ordinary meaning will vary with the context" (Lake Country (District) v. Kelowna Ogopogo Radio Controllers Association, 2013 BCSC 1971, at para. 18, citing Ruth Sullivan, Sullivan on the Construction of Statutes, 5th ed (Markham, ON: LexisNexis Canada, 2008), p. 27).
The ordinary meaning of a word or a group of words is not their dictionary meaning but the meaning that would be understood by a competent language user upon reading the words in their immediate context.
Ruth Sullivan, Statutory Interpretation, p. 61
However, even the ordinary meaning is not the end of interpretation. The first impression or ordinary meaning must be tested against the larger context and the legislative intent.
the plain meaning of the text is not in itself determinative and must be tested against the other indicators of legislative meaning — context, purpose, and relevant legal norms. The apparent clarity of the words taken separately does not suffice because they “may in fact prove to be ambiguous once placed in their context. The possibility of the context revealing a latent ambiguity such as this is a logical result of the modern approach to interpretation.”
La Presse inc. v. Quebec, 2023 SCC 22, para. 23.
None of this is simple, and judges even on the highest courts may disagree about the correct interpretation of a statute.
Courts may correct clear drafting errors when interpreting a statute
Applying the above approach to interpretation, courts may correct clear drafting errors. See e.g. Morishita v Richmond (Township), 67 D.L.R. (4th) 609 (B.C.C.A.), where the Court of Appeal interpreted "section 4" to mean "section 5."
the reference to s. 4 makes no sense at all ... I think the only rational conclusion is that the reference to s. 4 in the present s. 8 is a mistake. The section intended to be referred to is s. 5.