Skip to content

Locale issues #199

@jmarrec

Description

@jmarrec

Locale is not properly set in the docker container

/__w/workspace/workspace/workspaceOS/.bundle/ruby/3.2.0/gems/json-2.9.0/lib/json/common.rb:221:in `encode': "\xC3" on US-ASCII (Encoding::InvalidByteSequenceError)
	from /__w/workspace/workspace/workspaceOS/.bundle/ruby/3.2.0/gems/json-2.9.0/lib/json/common.rb:221:in `parse'
	from /__w/workspace/workspace/workspaceOS/.bundle/ruby/3.2.0/gems/json-2.9.0/lib/json/common.rb:221:in `parse'
	from /__w/workspace/workspace/workspaceOS/.bundle/ruby/3.2.0/gems/openstudio-standards-0.6.1/lib/openstudio-standards/standards/necb/NECB2011/necb_2011.rb:93:in `block in load_standards_database_new'
	from /__w/workspace/workspace/workspaceOS/.bundle/ruby/3.2.0/gems/openstudio-standards-0.6.1/lib/openstudio-standards/standards/necb/NECB2011/necb_2011.rb:92:in `each'
	from /__w/workspace/workspace/workspaceOS/.bundle/ruby/3.2.0/gems/openstudio-standards-0.6.1/lib/openstudio-standards/standards/necb/NECB2011/necb_2011.rb:92:in `load_standards_database_new'

The locale isn't actually set, so it's POSIX

root@d2baf72eee0d:/var/simdata/openstudio# locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

I have to run

locale-gen en_US en_US.UTF-8
# Either this
update-locale LANG=en_us.UTF-8
# or this
export LANG=en_us.UTF-8

Then it works.


It's possible my setup for the actual test I'm running is different than plain usage, because this still does work

$ docker run -it --rm nrel/openstudio:3.8.0

root@d2baf72eee0d:/var/simdata/openstudio# gem install openstudio-standards
root@d2baf72eee0d:/var/simdata/openstudio# ruby -e "require 'openstudio-standards'"

But the locale should probably be set to en_US.UTF-8 since that was the intent given

https://github.com/NREL/docker-openstudio/blob/2b53f0925ec52cb0fd1eafeca7e2f6cc1dd6c36c/Dockerfile#L17-L18

and

https://github.com/NREL/docker-openstudio/blob/2b53f0925ec52cb0fd1eafeca7e2f6cc1dd6c36c/Dockerfile#L40-L41

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions