INVALID MULTIBYTE CHAR (US-ASCII)

I was playing with Couchbase and plain Ruby in my Terminal. Then I got the error message:

invalid multibyte char (US-ASCII)

or

Message from application: /www/pro_edgudri_lv/app/models/plans_modification.rb:7: invalid multibyte char (US-ASCII)

/www/pro_edgudri_lv/app/models/plans_modification.rb:7: invalid multibyte char (US-ASCII)

/www/pro_edgudri_lv/app/models/plans_modification.rb:7: syntax error, unexpected $end, expecting keyword_end

..._change, :message => "nevar būt tukšs"

...                               ^ (SyntaxError)



If you got this error, you know that this is a result of having special chars. To fix this, you have to add a ‘magic comment’ in the script.


Here is a step-by-step instruction how to solve this problem:
1. Open your file
2. go to the VERY FIRST line of your code
3. write the following at the top of your file


#!/bin/env ruby
# encoding: utf-8



Example :-

payment_controller.rb:-


# encoding: utf-8
class PaymentsController < ApplicationController


end


WE CAN FOLLOW THE LINK :-

http://www.railszilla.com/invalid-multibyte-char-us-ascii-ruby/ruby
Post a Comment

Popular posts from this blog

CARRIERWAVE - UPLOAD ANY MEDIA (AUDIO , VIDEO AND IMAGE ) FILE IN RAILS

RAILS: UPLOADING PHOTOS VIA AMAZON S3 AND PAPERCLIP (UPLOADING FILES TO S3 IN RUBY WITH PAPERCLIP)

SELECT COUNTRY WITH STATE AND IT'S CITIES RAILS

UNINITIALIZED CONSTANT PAPERCLIP::STORAGE::S3::AWS

Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension.

HOW TO CALL RAILS API FROM SIMPLE HTML PAGE.

CREATE API FOR USER SIGN UP, LOGIN AND CREATE PUBLISHER WITH CURRENT USER