pyvis
pyvis copied to clipboard
Selection and filtering menu support in UTF-8 [experimental branch]
I find this package and the experimental branch to be extremely useful, and I appreciate its aesthetic appeal both visually and technologically. I believe I have discovered an issue with the selection menu in the experimental branch. The selection menu does not display words that contain UTF-8 characters, such as Hebrew and Arabic words. But, and this surprises me, the filtering tool worked. Perhaps there is a nuance in the way they represent the characters that cause this inconsistency.
Here is a mini example that can be used to reproduce the bug:
The first case (selection):
from pyvis.network import Network
net = Network(height="750px", width="100%", bgcolor="#222222", font_color="white",
select_menu=True)
net.add_nodes(['אברהם', 'שרה'])
net.add_edge('אברהם', 'שרה')
net.show('select.html')
The second case (filtering):
from pyvis.network import Network
net = Network(height="750px", width="100%", bgcolor="#222222", font_color="white",
filter_menu=True)
net.add_nodes(['אברהם', 'שרה'])
net.add_edge('אברהם', 'שרה')
net.show('filter.html')
The second case works as expected, while the first case displays the words as ????-???
@js-konda @BerserkerGaruk WDYT? Thank you!
While I am not a JS expert, I suspect that the following line in templates.html does not fulfill its purpose:
{% for node in nodes %}
<option value="{{ node.id }}">{{node.id}}</option>
{% endfor %}
I would appreciate your assistance in this matter.
with open(getcwd_name, "w+",encoding='utf-8') as out:
out.write(self.html)
elif self.cdn_resources == "in_line" or self.cdn_resources == "remote":
with open(getcwd_name, "w+",encoding='utf-8') as out:
out.write(self.html)