The believer should not allow his tongue to become accustomed to cursing and swearing. The Prophet (peace and blessings of Allaah be upon him) said: “The believer is not one who slanders, curses or utters foul or obscene speech.” Narrated by al-Tirmidhi and classed as saheeh by al-Albaani in Saheeh al-Tirmidhi.
The fasting person is enjoined to adopt a good attitude more than anyone else. Hence he is more obliged to forsake cursing, even if it is deserved. Hence the Messenger (peace and blessings of Allaah be upon him) enjoined the fasting person not to respond in kind to aggression, rather if someone curses him or tries to fight him, he should say: “I am fasting, I am fasting.” Agreed upon.
This is despite the fact that responding in kind is permitted, as Allaah says (interpretation of the meaning):
“Then whoever transgresses the prohibition against you, you transgress likewise against him”
But the fasting person is enjoined to behave in the best manner, and to refrain from bad deeds more than anyone else.
If the believer is affected by any tricks or whispers from the Shaytaan, he will not benefit at all from cursing him. Rather what is prescribed is to seek refuge with Allaah from the accursed Shaytaan.
Allaah says (interpretation of the meaning):
“And if an evil whisper from Shaytaan (Satan) tries to turn you away (O Muhammad) (from doing good), then seek refuge in Allaah. Verily, He is the All‑Hearer, the All‑Knower”
It was narrated from Abu’l-Maleeh that a man said: I was riding behind the Prophet (peace and blessings of Allaah be upon him) when an animal stumbled. I said: “Woe to the Shaytaan.” The Prophet (peace and blessings of Allaah be upon him) said: “Do not say woe to the Shaytaan, for if you say that he grows bigger until he is like a house, and he says, ‘It is by my power.’ Rather say: ‘Bismillaah (in the name of Allaah),’ for if you say that, he grows smaller, until he is like a fly.” Narrated by Ahmad, 20068; Abu Dawood, 4982; classed as saheeh by al-Albaani in Saheeh Abi Dawood.
And Allaah knows best.