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

  • SEARCH
  • Home
  • 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 9313231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:49:47+00:00 2026-06-19T01:49:47+00:00

So golang is designed to handle unicode/utf-8 properly. However, I seem to have problem

  • 0

So golang is designed to handle unicode/utf-8 properly.

However, I seem to have problem getting utf-8 characters printed out in my terminal’s standard output correctly.

The simplest program here:-

package main

import "fmt"

func main() {
    fmt.Println("Hello, 世界")
}

when executed, shows encoded characters.

$ go run hello.go
Hello, 世界

My terminal’s locale is set correctly:

$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

and I am using vim with set encoding=utf-8 and set fileencodings=utf-8 included in my .vimrc file.

This might actually be a vim problem. I used nano to write this script from scratch and name it hello2.go and the print out actually prints Hello, 世界 correctly. But the original hello.go script, created with vim, only gives me the gibberish Hello, ‰∏ñÁïå.

So just double check that my vim-created hello.go script is a UTF-8 Unicode text, I run the file command on it. Like this:-

$ file hello.go
hello.go: C source, UTF-8 Unicode text

So what gives? Why does my vim created hello.go script above print out gibberish but my nano created hello2.go (which contains the same exact lines of code) does not?

$ file hello2.go
hello2.go: C source, UTF-8 Unicode text

In fact, when I open vim-created hello.go with nano, the source code now reads:-

package main

import "fmt"

func main() {
        fmt.Println("Hello 世界")
}

But if I open the same vim-created hello.go with vim, the source code reads:-

package main

import "fmt"

func main() {
    fmt.Println("Hello, 世界")
}

Why is this so?

  • 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-19T01:49:49+00:00Added an answer on June 19, 2026 at 1:49 am

    These are the offending lines in my .vimrc that is causing me this problem.

    if has("gui_running")
        set guitablabel=%t%=%m  "Set the label of the tabs
        set nomacatsui anti enc=utf-8 tenc=macroman gfn=Monaco:h11
        " set window size
        set lines=40
        set columns=120
    else
        set enc=utf-8 tenc=macroman gfn=Monaco:h11
        set fenc=utf-8
    endif
    

    Specifically, tenc=macroman is screwing up my encoding at terminal level.

    Switched it to tenc=utf-8 and all is good.

    Wasted 4 hours of my life on this I-should-have-seen-this-coming problem! Ugh.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use a GO server (golang.org), which does have good support for encryption and
I have seen How to read/write from/to file using golang? and http://golang.org/pkg/os/#File.Write but could
In Golang, how do I serve static content out of the root directory while
I'm trying out LiteIDE for golang and there are no docs to speak of
I'm quite new in golang. Here is my problem: I want to get the
I have recently completed the Wiki web development tutorial ( http://golang.org/doc/articles/wiki/ ). I had
I'm currently learning how to develop with Go (or golang) and I have a
I'm trying to execute an example from golang.org : http://tour.golang.org/#63 I Have Changed The
I try to call the ExpFloat64() function of the rand package (http://golang.org/pkg/rand/). However, it
Looking how actively golang packages grow and improve I wonder how the problem with

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.