Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8336717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:04:55+00:00 2026-06-09T04:04:55+00:00

We all know the magical # encoding: utf-8 line. But I’ve seen several other

  • 0

We all know the “magical”

# encoding: utf-8

line. But I’ve seen several other alternative notations, some of them pretty wild. Do you know or use any of those? Is there some more general rule of what is acceptable?

Edit: Ok, apparently there are exactly 3 ways:

# encoding: UTF-8

# coding: UTF-8

# -*- coding: UTF-8 -*-

(more at http://blog.grayproductions.net/articles/ruby_19s_three_default_encodings)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:04:56+00:00Added an answer on June 9, 2026 at 4:04 am

    No, there are not “exactly 3 ways” to specify the ‘magic comment’ — there are an infinite number of them. Any comment on the first line that contains coding: will work, according to JEG2:

    … the preferred way to set your source Encoding … it’s called a magic comment. If the first line of your code is a comment that includes the word coding, followed by a colon and space, and then an Encoding name, the source Encoding for that file is changed to the indicated Encoding.

    So, any of these should work:

    # coding: UTF-8
    # encoding: UTF-8
    # zencoding: UTF-8
    # vocoding: UTF-8
    # fun coding: UTF-8
    # decoding: UTF-8
    # 863280148705622662 coding: UTF-8 0072364213
    # It was the night before Christmas and all through the house, not a creature was coding: UTF-8, not even with a mouse.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We all know about Boost . What other free C++ libraries are worth using?
We all know that a readonly reference type variable's reference can't change, but the
We all know how the adjacent selector works (p+p), but I wonder if there's
We all know there are some case sensitive languages, as well as case insensitive.
We all know that Mathematica is great, but it also often lacks critical functionality.
We all know when to use include guard, but when shall we not use
We all know how to use <ctrl>-R to reverse search through history, but did
We all know that RAW pointers need to be wrapped in some form of
We all know what virtual functions are in C++, but how are they implemented
We all know the good old disable the submit button trick but what are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.