✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Utf-8 encode hovertemplate plotly javascript

Hi, in php i structure data to plot in js with the help of plotly lib and ajax on request. the hovertemplate line of code works when i use english words, but it doesnt work when i use swedish words like ä,å, ö. All of my files are utf8-encoded.
I couldnt find any information about this on your website and there arent similar questions here, so i was wondering if anyone had an idea on how to do it?

here is the line of code that is working:

"hovertemplate" => '<b>Price:</b> %{y:.2f} '.$this->to.'<br><b>Highest:</b> %{customdata:.2f}<br> 
 <b>Datum:</b> %{x}<br>'

here is line of code that doesnt work and have swedish words instead of price and highest:

"hovertemplate" => '<b>Värdet:</b> %{y:.2f} '.$this->to.'<br><b>Högsta:</b> %{customdata:.2f}<br> 
 <b>Datum:</b> %{x}<br>'