# Assume 'text' is your variable with garbled characters text = "【国产真实灌醉mjгЂ‘еѕ®дїЎй™„иї‘дєєе‹ѕжђзљ„е€љжЇ•дёље¦з”џе¦№пјЊж·±е¤ње–ќеѕ—烂醉如泥,带回家玩弄粉嫩胴体啪啪"
import chardet
# Detect the encoding result = chardet.detect(text.encode()) charenc = result['encoding']