Open this photo in gallery A picture illustration shows a WeChat app icon in Beijing, in a Dec. 5, 2013, file photo. Tencent, the company that owns WeChat, released a statement Tuesday afternoon saying it is 'taking immediate action to fix a translation bug on WeChat.' Petar Kujundzic/Reuters

The maker of Chinese app WeChat has apologized after its auto-translation software rendered an emoji of the Canadian flag into the phrase “He’s in prison.”

The unexpected translation occurred when an icon for the flag was inserted into a Chinese sentence and then translated into English, using an automated feature in WeChat meant to smooth communication between speakers of the two languages. The bug did not affect Canada alone: on Tuesday WeChat translated the Andorran flag into “He was killed,” the Aruban flag into “You’re under arrest” and the flag of the Democratic Republic of the Congo into “He’s dead.”

But the rendering of the maple leaf into “He’s in prison” drew immediate attention and spread across social media. Last December China detained two Canadians, Michael Kovrig and Michael Spavor, and both men remain in prisonlike facilities, barred from seeing lawyers or family members. Their detention is generally seen as retaliation for the Dec. 1, 2018, arrest in Vancouver of Huawei executive Meng Wanzhou.

Story continues below advertisement

Tencent, the company that owns WeChat, released a statement Tuesday afternoon saying it is “taking immediate action to fix a translation bug on WeChat. We thank users for flagging this matter and apologize for any inconvenience caused.”

By early evening, the bizarre flag translations had vanished.

Tencent did not, however, provide any explanation for what happened, leading to speculation that the cause was malicious – or perhaps an indication that translation algorithms trawling digital communications had automatically picked up a relationship between the words “Canada” and “prison” in discussions in China.

“It’s either a joke or a machine-learning issue, but it may also indicate [the Canadian flag] has been used in connection with talking about prison,” said James Hull, an investment analyst in Beijing who is co-host of the China Tech Investor podcast.

The Ukrainian flag was also translated into “He’s in prison” before the company fixed the error.

Other translations were equally strange, if less politically sensitive. The emojis for the flags of Iceland and Ireland were rendered as “Hey. Hey,” and “Hey! Hey!” That of Greece was “Oh, yeah.” Bulgaria: “Hey, Chauncey!” South Africa: “He’s a henchman.” Egypt: “I’m sorry.” Brazil: “Oh, my God.” Turkey: “Oh, no.” Madagascar: “Heavy duty.” Cambodia: “Beyond recognition.” Bosnia and Herzegovina: “He’s in a coma.” Afghanistan: “In the middle of nowhere.” Myanmar: “Jackass.” Argentina: “You’re in love.”

But the software made no such errors with the flags of major Chinese trading partners, such as the United States, Germany, France, South Korea or Japan. Nor did it produce unexpected results with the flags of China, Taiwan or Hong Kong. (Neither Google Translate nor the digital translator operated by China’s Baidu attempt to translate flag emojis.)

Story continues below advertisement

Tencent operates an artificial-intelligence lab that employs experts in natural-language processing. A researcher there declined to comment.

In China, WeChat is a near-universal tool, used for chatting, shopping, payment and a myriad of other services – including taking care of utility bills, booking ride-hailing services and ordering food for delivery. The app even allows users to pay their income taxes.

But Tencent has also sought to make WeChat into a global platform for communication and digital payment, an expansion that has occasionally courted controversy, particularly when the app censors conversations between international users on topics China considers sensitive.

Tencent hasn’t disclosed the number of active international users since 2013, but Questmobile, a Beijing-based consulting firm, estimates the number stood at 169.6 million by the end of 2018. Earlier this year, Tencent said its total daily user base had reached 1.11 billion.

Tencent is hardly alone in encountering machine-translation errors. Entire websites are devoted to cataloguing mistakes made by Google Translate, including rendering a specific type of dumpling into curse words and auto-translating a Galician culinary specialty into “clitoris.”

WeChat’s unusual translations of flag emojis ”doesn’t necessarily reflect badly on Tencent. This is a global issue,” said Manya Koetse, who writes about Chinese social media and is the editor-in-chief of www.whatsonweibo.com.

Story continues below advertisement

But others saw a hint of subversion creeping into an app whose ubiquity has made it a potent tool for Chinese state surveillance and censorship.

“Every time I interact with a tech person, a TV channel producer or a computer social media hacker, I’m always struck by the level of contempt for the censorship project,” said David Moser, a Chinese cultural observer and author of A Billion Voices: China’s Search for a Common Language.

Perhaps, he said, someone at Tencent engaged in a bit of “mischief making,” a “slightly subversive tweaking of the [Communist] Party nose.”

With reporting by Alexandra Li

Our Morning Update and Evening Update newsletters are written by Globe editors, giving you a concise summary of the day’s most important headlines. Sign up today.