Giter Site home page Giter Site logo

utf-8 !!! about telegram-bot-sdk HOT 14 CLOSED

irazasyed avatar irazasyed commented on May 16, 2024
utf-8 !!!

from telegram-bot-sdk.

Comments (14)

irazasyed avatar irazasyed commented on May 16, 2024

That error is directly from Telegram. It has got nothing to do with the library AFAIK.

Can you re-check with v1.0 with same keyboard and everything else?

from telegram-bot-sdk.

derakoola avatar derakoola commented on May 16, 2024

I have 3 bots!
@allStoreBot
@leitnerBot
@nowArzBot
@partnerLookBot

all bots work correctly except the first one!
I checked everything that i think may cause it! I have no idea now!

It's strange! because it works if you touch the same keyboard twice!

img_2015-12-06 15 44 38

from telegram-bot-sdk.

irazasyed avatar irazasyed commented on May 16, 2024

Maybe try with another Telegram client? Like iOS/Desktop? It could also be a bug with their client.

from telegram-bot-sdk.

derakoola avatar derakoola commented on May 16, 2024

Error in devices:
Telegram Desktop mac OSX: yes
Telegram Desktop Windows: yes
Telegram android: yes

Telegram IOS: not yet!

from telegram-bot-sdk.

irazasyed avatar irazasyed commented on May 16, 2024

Ahan! Report this to Telegram Bot Support, So they can fix this issue across all their clients.

from telegram-bot-sdk.

derakoola avatar derakoola commented on May 16, 2024

OK, Thanks.

from telegram-bot-sdk.

derakoola avatar derakoola commented on May 16, 2024

I could find it!

filter text before sending it by:
$text = iconv("UTF-8", "UTF-8//IGNORE", $text),

There were some char not in utf-8 standard, so they made errors!

from telegram-bot-sdk.

jonnywilliamson avatar jonnywilliamson commented on May 16, 2024

Please give an example of what message failed BEFORE you filtered it through iconv().

Does this only apply to normal text messages?

Will it also fail if used as a caption for an image or a video?

Thank you.

from telegram-bot-sdk.

jonnywilliamson avatar jonnywilliamson commented on May 16, 2024

I don't think you've got the right solution to your problem.

The docs state:

If you append the string //TRANSLIT to out_charset transliteration is activated. This means that when a character can't be represented in the target charset, it can be approximated through one or several similarly looking characters. If you append the string //IGNORE, characters that cannot be represented in the target charset are silently discarded. Otherwise, E_NOTICE is generated and the function will return FALSE.

So in your case you are passing a string to the function that you want converted to UTF-8.

However you're telling the function that the input string is UTF-8 already but that it is to DROP any characters that are invalid.

Surely the message text you are trying to send is now missing characters?

from telegram-bot-sdk.

derakoola avatar derakoola commented on May 16, 2024

@jonnywilliamson
for normal text it works fine.

I had some info that filled by users and users used abnormal letters.

I prefer to delete abnormal letters rather that translate it.

from telegram-bot-sdk.

jonnywilliamson avatar jonnywilliamson commented on May 16, 2024

And have you tested if the same issue happens if you add those characters to image/video captions?

That would be another place that text might need to be filtered.

from telegram-bot-sdk.

derakoola avatar derakoola commented on May 16, 2024

@jonnywilliamson

no, I don't test in for caption of images! also I think videos don't have a caption!

and also I can't find that letters!
I scaned it myself and I can't detect abnormal letters!
but when I used `$text = iconv("UTF-8", "UTF-8//IGNORE", $text);`` everything be OK.

from telegram-bot-sdk.

jonnywilliamson avatar jonnywilliamson commented on May 16, 2024

image

from telegram-bot-sdk.

derakoola avatar derakoola commented on May 16, 2024

@jonnywilliamson
You right. 👍

from telegram-bot-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.