Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message Sending Failure with arabic symbols #4401

Open
3 tasks done
yarodevuci opened this issue Jun 29, 2024 · 4 comments
Open
3 tasks done

Message Sending Failure with arabic symbols #4401

yarodevuci opened this issue Jun 29, 2024 · 4 comments

Comments

@yarodevuci
Copy link

Code that causes the issue

await bot.send_message(chat_id, message=message, link_preview=False)

Failed message: " گندم را دزدیدند صدای اعتراض هابلند شد، نان بین مردم پخش کردند اعتراض هاخاموش شد، این جماعت فقط به دنبالسیر کردن شکم خود هستند نه گرفتن حقشان! "نویسنده: برتولت برشت____________________@__hijran

Error: Exception Type: EntityBoundsInvalidError. Some of provided entities have invalid bounds (length is zero or out of the boundaries of the string) (caused by SendMessageRequest)

Expected behavior

sending without issues

Actual behavior

Error: Exception Type: EntityBoundsInvalidError. Some of provided entities have invalid bounds (length is zero or out of the boundaries of the string) (caused by SendMessageRequest)

Traceback

No response

Telethon version

1.36.0

Python version

3.10

Operating system (including distribution name and version)

Ubuntu

Other details

No response

Checklist

  • The error is in the library's code, and not in my own.
  • I have searched for this issue before posting it and there isn't an open duplicate.
  • I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip and triggered the bug in the latest version.
@yarodevuci
Copy link
Author

yarodevuci commented Jun 29, 2024

Any recommendations how to handle such things? @Lonami

@yarodevuci
Copy link
Author

Current workaround is to use parse_mode= "HTML"

@Lonami
Copy link
Member

Lonami commented Jul 24, 2024

I'm struggling a lot with RTL. If you clone the repository and add a new test in

def test_offset_rtl():
    """
    https://github.com/LonamiWebs/Telethon/issues/4401
    """
    text =...
    entities = [...]
    parsed = ...

then I'd be able to more easily test and reproduce the problem. You can also run it offline with:

pytest -ktest_offset_rtl -vvv

@yarodevuci
Copy link
Author

Thanks! will do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants