Encoding from js to ruby

Hi all,
I have a misterious problem.

I do a new Dynamic Component Interface (where choice is dependant of the other choice).
Everything is working well except for one point:

→ one value is “UV_–Solid" when user choose it, javascript send it as "UVSolid" to ruby call back.
Ruby receive "UV
‚Äì_Solid” ??? If I change with the gsub!(‘‚Äì’,‘–’) its work but I don’t feel clean, because other trouble could come in the future.
Remark ‘–’ it’s not the standard minus ‘-’.
I thinks its a problem of encoding but I not sure at all.

Thanks for your help !

what encoding are you using for all your files?

do you have to use any ‘odd’ chars?

john

Hi John. I don’t know whats is my ruby encode.

html is in UTF 8
Jquery and JS , I don’t know

Entry are coming from user, they can use ‘strange’ chars like ‘–’ (that is not on my keyboard).

THX John !!

all your files need to be saved as utf8 [without bom]…

if you have no control over input values then you need to escape it in the JS and un-escape back in the ruby…

or use get_element_value instead of add_action_callback to get the user input…

I posted a test script at Sketchucation ages ago that shows the issue…

2 Likes

Thanks John . I will try to use it