gazay / gon

Your Rails variables in your JS
MIT License
3.05k stars 184 forks source link

How to use Base64.urlsafe_decode64 for a gon variable. #245

Open mgtf opened 6 years ago

mgtf commented 6 years ago

Hi,

I'm using something like

  protected

  def init_gon
    ...
    gon.vapid_public_key = Base64.urlsafe_decode64(Rails.application.secrets.vapid[:public_key])
  end

But the Gon::Base.render_data complains that : "\xD2" from ASCII-8BIT to UTF-8 I've tried different string conversion using force_encoding method without success.

Any hints ? Thanks a lot