Skip to content

os: mishandled non-ascii console input on windows #4760

Closed
@alexbrainman

Description

@alexbrainman
What steps will reproduce the problem?

- Launch cmd
- Enter chcp 65001  (This selects the UTF-8 code page)
- Change the font to Lucida Console for the cmd window by right clicking the title bar
and selecting properties->font (Need to pick a font with glyphs for non-latin chars)
- run this program:

package main

import (
    "bufio"
    "fmt"
    "os"
    "log"
)

func main() {
    fmt.Print("Enter you name: ")
    in := bufio.NewReader(os.Stdin)
    input, err := in.ReadString('\n')
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("Hello %v", input)
}

What is the expected output?

Enter you name: ã
Hello ã

What do you see instead?

Enter you name: ã
2013/02/05 15:30:08 EOF
exit status 1

Please use labels and text to provide additional information.

hg id
44bc519f3511 tip

user report: http://goo.gl/LWrjJ

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions