Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unicode: IsPrint('\u3000') returns false #4661

Closed
gopherbot opened this issue Jan 15, 2013 · 1 comment
Closed

unicode: IsPrint('\u3000') returns false #4661

gopherbot opened this issue Jan 15, 2013 · 1 comment
Milestone

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 15, 2013

by tts.yamamoto:

What steps will reproduce the problem?
1. http://play.golang.org/p/Gtvj9bhAFl

What is the expected output?
IsPrint('\u3000') returns true.

Please provide any additional information below.
U+3000 (Ideographic Space) is used as a space character in Japanese.
So It should be treated as a printable character.
@rsc
Copy link
Contributor

@rsc rsc commented Jan 15, 2013

Comment 1:

"IsPrint" is a Go-defined property, not a Unicode-defined one. The only space character
that satisfies IsPrint is the ASCII space. IsPrint gets used by things like %q to decide
whether to escape a rune or not. By admitting only a single space character, we make
sure that if you see something that looks like a space in a quoted string, it really is
an ASCII space, not some other Unicode space. This applies to all kinds of spaces, not
just Japanese spaces. For example, IsPrint('\u00A0') is false too.
If you want to allow all kinds of spaces, use the Unicode-defined "graphic" property,
called as unicode.IsGraphic.

Status changed to WorkingAsIntended.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.