Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.
/ magic-comment Public archive

Easily manage magic comments for encoding for your ruby applications

License

Notifications You must be signed in to change notification settings

lohn/magic-comment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magic Comment

Magic Comment is a little tool that allows you to quickly add or modify the magic comments that indicate source file encoding for an entire directory structure, please note that this tool only sets the comments, and does not perform any file encoding conversion whatsoever.

If you are looking for a way to convert files to a specific encoding, check out iconv (GNU)

I originally wrote this to get rid of "invalid multibyte char (US-ASCII)" errors when writing strings containing non ascii characters like éöàüèä in ruby on rails controllers

this program was based on https://github.com/m-ryan/magic_encoding

Installation

gem install magic-comment

Usage

you can pass the path to where you want the tool to run.

magic-comment [path1 [path2 ...]]

this will prepend every ".rb", ".rake" and ".haml" file in the working directory (recursively) with the following line :

# coding: utf-8

Notes :

  • existing magic comments are replaced
  • the rest of the file remains unchanged

About

Easily manage magic comments for encoding for your ruby applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages