TORONTO -- One of the largest social networks in the world says it has fixed a bug that caused the Canadian flag emoji to translate as the phrase "he's in prison."

Twitter user James Hull was likely one of the first people to notice the unusual translation. He tweeted about it early Tuesday morning.

Weird thing (bug?) in WeChat.. try it out: type in chinese and the Canadian flag emoticon, then translate it. pic.twitter.com/wRd19RXJAU — James Hull (@jameshullx) December 17, 2019

Rene Bidart, a PhD student at the University of Waterloo who is studying in Hong Kong, experimented by tweeting one consistent Chinese character along with the emoji of other countries' flags. North Korea's flag translated from Chinese to English as "Hey, hey!", Switzerland's as "No." and Belgium's as "Oh, it's hot."

The flag of Panama carried the same translation as the Canadian flag, according to TechNode, a website focused on Chinese technology.

The Canadian translation was particularly interesting given the ongoing quarrel between Canada and China. Two Canadians, Michael Kovrig and Michael Spavor, have been detained in China since December 2018 in what is widely seen as a response to the Canadian government's arrest of Huawei chief financial officer Meng Wanzhou several days earlier.

Huawei and Tencent – the owner of WeChat – are not directly connected, but are two of the most prominent companies in China's tech sector. WeChat is widely used in China and claims to have more than one billion monthly active users worldwide. Independent rankings consistently rank it among the five most-used social networking apps in the world.

The real story behind the mistranslation, however, appears to have less to do with politics than it does with technology.

Twitter user Daniel Sinclair described the quirk as a likely example of "how AI can go very wrong." He theorized that the neural network powering WeChat's translation service may have discovered that the Canadian flag emoji often appeared in messages about Kovrig and Spavor, and assumed a more direct connection than actually exists.

There is a reasonable explanation for what's happening here. The translation NN that Tencent built appears to have been trained w/ bad data. Maybe w/ WeChat Moments headlines — & that dataset caught the 'Canadian spy' propaganda from the Communist Party. https://t.co/6L0WKBJNIK — Daniel Sinclair (@_DanielSinclair) December 17, 2019

Bidart said much the same in an email to CTVNews.ca, adding that he suspected the mistranslation was unintentional.

Word association is increasingly being used in neurolinguistic programming such as translation services, he said – and if that's how WeChat's translator is powered, then "words that appear together in the training data get clustered together, so if prison commonly appears with Canada, these things could have similar embeddings."

Tencent did not respond to a request for comment from CTVNews.ca before this story was published. TechNode quoted a spokesperson for Tencent as calling the issue "a translation bug" and said the company was taking "immediate action to fix (it)."

According to TechNode, the bug is only known to have affected the iOS version of WeChat.