This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: string in string not working
Type: behavior Stage: resolved
Components: Versions: Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: m.s.sharifzade, vstinner
Priority: normal Keywords:

Created on 2020-11-30 10:31 by m.s.sharifzade, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
string bug.py m.s.sharifzade, 2020-11-30 10:31
Messages (2)
msg382140 - (view) Author: Mohammad Sadra Sharifzadeh (m.s.sharifzade) Date: 2020-11-30 10:31
I want to know whether some string is in same string or not (yeah the SAME) 
in the file attached I have two expressions:
1- print('اندیمشک' in 'اندیمشک')
2- print('اندیمشک' in 'اندیمشک')
as you can see both of them are same thing but if you run the program you see it returns True for first one and False for second one. the difference between two expressions is that in the first one I typed both of the strings but in the second one I copied second string from a file and type first string

Thanks
msg382142 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-30 10:53
The two strings a different, that's why Python returns False.

a = U+0627 U+0646 U+062f U+064a U+0645 U+0634 U+06a9
b = U+0627 U+0646 U+062f U+06cc U+0645 U+0634 U+06a9

U+064a != U+06cc

>>> unicodedata.name('\u064a')
'ARABIC LETTER YEH'
>>> unicodedata.name('\u06cc')
'ARABIC LETTER FARSI YEH'

Python doesn't know arabic, it only compares code pointers: the number 0x064a is not equal to the number 0x06cc.

It's not a bug, but a deliberate choice.
History
Date User Action Args
2022-04-11 14:59:38adminsetgithub: 86677
2020-11-30 10:53:55vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg382142

resolution: not a bug
stage: resolved
2020-11-30 10:31:00m.s.sharifzadecreate