Skip to content

Instantly share code, notes, and snippets.

@kosyfrances
Last active January 21, 2016 09:02
Show Gist options
  • Select an option

  • Save kosyfrances/d83c6c5904a222fac43e to your computer and use it in GitHub Desktop.

Select an option

Save kosyfrances/d83c6c5904a222fac43e to your computer and use it in GitHub Desktop.
unknown locale: UTF-8 error

We had this error when I was trying to use django rest swagger in the api we built,

unknown locale: UTF-8
Request Method:	GET
Request URL: http://localhost:8000/docs
Django Version:	1.8.2
Exception Type:	ValueError
Exception Value:	
unknown locale: UTF-8```

We had to set locale to en_US by doing this in the bash profile - 
` export LC_CTYPE=en_us `
Then restarted the bash profile using `source` and that solved the problem.

To check if the issue has been solved, on a python shell, do  
```import locale```   
```locale.getdefaultlocale() ```  
It should show you default locale as `en_US` without throwing errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment