discord.py
discord.py copied to clipboard
Some iOS quotes not working
Summary
Some quotes on iOS are not working. The quotes used by the iOS mobile app seems to be dependend on the choosen keyboar language.
Reproduction Steps
I don't have an iPhone so I can't realy reproduce it.. But users told me that quotes with the unicode \u201e
, \u201c
(German keyboard) are not working. Maybe there are more out there? Android uses \u0022
no matter which language is selected
Checklist
- [x] I have searched the open issues for duplicates.
- found that issue: https://github.com/Rapptz/discord.py/issues/1032 but it seems that some quotes are missing
System Information
- Python v3.6.4-final
- discord.py v1.3.3-final
- aiohttp v3.6.0
- websockets v6.0
- system info: Windows 10 10.0.18362
Both \u201e and \u201c are in the quotes dictionary- https://github.com/Rapptz/discord.py/blob/master/discord/ext/commands/view.py#L35
Is the order correct? Does „ precede ‟ or is it the other way maybe?
'„' precedes '“'; '‟' is just the wrong unicode symbol for closing German quotes I think.
Ah, you've got it- _quotes['\u201e']
resolves to \u201f
which isn't \u201c
. Consulting the wikipedia page, \u201c
seems to be the correct option.
It also introduces a whole lot of quotes we don't currently support!
Ah, taking a second look and check- Bosnian, Croatian, Hungarian, Latvian, Polish, Romanian, and Serbian all use „…”
(\u201e:\u201f) while Albanian, Bulgarian, Czech, Danish, Estonian, Georgian, German, Icelandic, Lithuanian, Macedonian, Slovak, Slovene, Sorbian, and Uzbek use „…“
(\u201e:\u201c). Ukranian, apparently allows both.
In any case, slightly annoying, and may introduce some parsing ambiguities.
Yes... a bit annoying that iOS uses different quotes for different languages..
https://www.howtogeek.com/344310/how-to-turn-off-smart-punctuation-on-your-iphone-and-ipad/
In my opinion this isn't realy a solution. I can't tell anyone to switch off their smart punctuation..
I had this problem too; the only solution is to turn off smart punctuation as Soheab said. It doesn't do much but rather take you back to the normal punctuation. I mean, it's not really Discord.py's fault so yeah.
A quick patch with some obvious side effects would be to use the following code which coerces all quotes on a quote failure to "
-
async def on_command_error(ctx, error):
if isinstance(error, commands.UnexpectedQuoteError):
if hasattr(ctx, 'coerced_quotes'):
return
if error.quote in '‹〝﹂﹃﹄⹂〉«『」‚"’〞›‟»》』‛"‘」﹁「《「〈':
return
ctx.coerced_quotes = True
content = ctx.message.content
regex = '[„”“]'
ctx.message.content = re.sub(regex, '"', content)
await bot.invoke(ctx)
You might be able to better filter this using the quote
attr of UnexpectedQuoteError. ~~I also suspect this code might have a recursive problem, but I can't think of a way it would and I don't want to think about how to fix it.~~ It absolutely does and is now resolved. Either way: quick, easy, flawed patch.
Edit: on second thought, this code might work better. Haven't tested either of these, mind you.
async def on_command_error(ctx, error):
if isinstance(error, commands.UnexpectedQuoteError):
if hasattr(ctx, 'coerced_quotes'):
return
if error.quote == '”':
ctx.message.content = ctx.message.content.replace('”', '“')
ctx.coerced_quotes = True
await bot.invoke(ctx) ```
Is there any progress on this?