sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

Parser::Source::Buffer.reencode_string

Recognize encoding of `input` and process it so it could be lexed.

 * If `input` does not contain BOM or magic encoding comment, it is
   kept in the original encoding.
 * If the detected encoding is binary, `input` is kept in binary.
 * Otherwise, `input` is re-encoded into UTF-8 and returned as a
   new string.

This method mutates the encoding of `input`, but not its content.

Source | Google | Stack overflow

Edit

git clone [email protected]:sonic-pi-net/sonic-pi.git

cd sonic-pi

open app/server/ruby/vendor/parser-2.2.2.1/lib/parser/source/buffer.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Parser--Source--Buffer-reencode_string-for-pr


# Commit to git

git add app/server/ruby/vendor/parser-2.2.2.1/lib/parser/source/buffer.rbgit commit -m "better docs for Parser::Source::Buffer.reencode_string"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Parser--Source--Buffer-reencode_string-for-pr

hub pull-request


# Celebrate!