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

popup does not show Arabic alphabet. it shows like 'عبدالصمد القرشي)' #1431

Closed
sallllam opened this issue Dec 30, 2020 · 9 comments

Comments

@sallllam
Copy link

Describe the bug
A clear and concise description of what the bug is.

To Reproduce

[ Include a code snippet that produces your bug. Make it standalone, we should be able to run it. ]

[ Include a data sample or link to your data if necessary to run the code ]

Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • Browser [e.g. chrome, firefox]
  • Jupyter Notebook or html files?
  • Python version (check it with import sys; print(sys.version_info))
  • folium version (check it with import folium; print(folium.__version__))
  • branca version (check it with import branca; print(branca.__version__))

Additional context
Add any other context about the problem here.

Possible solutions
List any solutions you may have come up with.

folium is maintained by volunteers. Can you help making a fix for this issue?

@sallllam sallllam changed the title popup does not show Arabic alphabet popup does not show Arabic alphabet. it shows like 'عبدالصمد القرشي)' Dec 30, 2020
@jtbaker
Copy link
Contributor

jtbaker commented Dec 30, 2020

I believe this is a duplicate of #1320

Please uninstall and reinstall folium and branca directly from the master branch to resolve, until the next release is pushed to PyPI, using

pip uninstall folium branca -y

pip install git+https://github.com/python-visualization/folium.git@master
pip install git+https://github.com/python-visualization/branca.git@master

@sallllam
Copy link
Author

sallllam commented Jan 7, 2021

I did but it does not work

@Conengmo
Copy link
Member

Conengmo commented Jan 7, 2021

You only posted a title and didn't fill in the issue template. We can't really help you like this.

@sallllam
Copy link
Author

sallllam commented Jan 8, 2021

image

It correctly shows English characters. in the other hand, Arabic characters not in correct way.

@Conengmo
Copy link
Member

Conengmo commented Jan 8, 2021

RIght, but what code and data did you use to create this? What software versions did you use? Please take a look at your issue description and fill out the questions listed there.

@sallllam
Copy link
Author

sallllam commented Jan 8, 2021

I use pycharm for flask server and below the code
def location():
#pd.read_csv("d:/bd/alq.csv")

lat1 = request.args['lat']
lng1= request.args['lng']
df = getinformation(lat1, lng1)
#df['name']=df['name'].apply(lambda x:str.encode(x,'utf-8'))
print(df[['name']].head())
folium_map = folium.Map(location=[lat1,lng1], zoom_start=12)
folium.Circle(
    location=[lat1,lng1],

    radius=5000,
    color='green',
    fill=True,
    fill_color='green'
).add_to(folium_map)

for lat, lng, label,color in zip(df['lat'], df['lng'], df['name'],df['color']):
    #label= base64.b64encode(label.encode('Image'))
    label=  label.encode('utf-8-sig')
    #label = folium.Popup(label.encode ('utf-8-sig'), parse_html=True)

    folium.Marker([lat, lng], radius=10, popup=label, color=color, fill=True, fill_color='black',icon = folium.Icon(color=color),
                        fill_opacity=0.7, parse_html=False).add_to(folium_map)

folium.Marker([lat1, lng1], radius=10,popup="location for new store", color="green", fill=True, fill_color='green', icon = folium.Icon(color='green'),
              fill_opacity=0.7, parse_html=False).add_to(folium_map)
#folium.Circle([lat1, lng1], radiou=150000, color="blue", fill=True, fill_color='blue').add_to(folium_map)
return folium_map._repr_html_()

the data is in this link: https://github.com/sallllam/copston/blob/main/foliumdf.csv

libraries:
Flask==1.1.2
folium==0.0.0 after install it from pip install git+https://github.com/python-visualization/folium.git@master but before it was 0.12
branca==0.4.2 after install it from pip install git+https://github.com/python-visualization/branca.git@master

@sallllam
Copy link
Author

sallllam commented Feb 1, 2021

please help

@matkoniecz
Copy link

the data is in this link: https://github.com/sallllam/copston/blob/main/foliumdf.csv

link is dead

utf-8-sig

Is CSV file in a matching encoding?

@Conengmo
Copy link
Member

I'm pretty sure this has been fixed with branca v0.4.2.

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

4 participants