reflex-frp / reflex-platform

A curated package set and set of tools that let you build Haskell packages so they can run on a variety of platforms. reflex-platform is built on top of the nix package manager.
https://reflex-frp.org
BSD 3-Clause "New" or "Revised" License
720 stars 164 forks source link

Support for UTF-8 #5

Closed paronsson closed 9 years ago

paronsson commented 9 years ago

Hi,

reflex & try-reflex is really great. Thanks!

But locale support for UTF-8 is not included in try-reflex. This is the first time I have been in contact with Nix and I have not been able to understand how to modify the environment to support UTF-8.

I could not build reflex-todomvc because of this.

What should I do to use UTF-8?

BR Pär-Anders

ryantrinkle commented 9 years ago

Hi Pär-Anders,

Could you give me some more information about your situation? It would be helpful to know your OS, the locale your machine is in usually, and the error message (and any other output) you're getting.

Thanks, Ryan

paronsson commented 9 years ago

Hi Ryan,

Thanks for helping!

BR Pär-Anders

I'm on Ubuntu 14.04

pa@pacompute:~$ locale -a
C
C.UTF-8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
POSIX
sv_SE.utf8

LC_*==sv_SE.UTF-8

Now when using Nix

[nix-shell:~/tmp/try-reflex/try-reflex]$ locale -a
C
POSIX

LC_*==

When running examples/host.hs and entering 'abcdeå':

[nix-shell:~/tmp/try-reflex/try-reflex/examples]$ ./host
Welcome to the example Reflex host app; press Ctrl+C to exit
Press any key to process it with the Reflex FRP engine
Input Event: 'a'
Output Behavior: "a"
Input Event: 'b'
Output Behavior: "ab"
Input Event: 'c'
Output Behavior: "abc"
Input Event: 'd'
Output Behavior: "abcd"
Input Event: 'e'
Output Behavior: "abcde"
host: <stdin>: hGetChar: invalid argument (invalid byte sequence)

When building reflex-todomvc using ghcjs:

[nix-shell:~/tmp/try-reflex/try-reflex/reflex-todomvc]$ cabal install --ghcjs 
Resolving dependencies...
Configuring file-embed-0.0.8.2...
Failed to install file-embed-0.0.8.2
Build log ( /home/pa/.cabal/logs/file-embed-0.0.8.2.log ):
cabal: Error: some packages failed to install:
file-embed-0.0.8.2 failed during the configure step. The exception was:
user error
('/nix/store/hq1gjvzfazfzkm6d595786laxvpsm6wa-ghcjs-0.1.0/bin/ghcjs' exited
with an error:
/run/user/1000/file-embed-0.0.8.2-9669/file-embed-0.0.8.2/dist/setup/setup.jsexe/all.js:
hGetContents: invalid argument (invalid byte sequence)
)
reflex-todomvc-0.1 depends on file-embed-0.0.8.2 which failed to install.
ryantrinkle commented 9 years ago

Hi Pär-Anders,

I've made a change that should allow your default locale to be used inside the nix-shell. I think this will resolve your issue - please let me know if it doesn't!

Ryan

paronsson commented 9 years ago

Thanks Ryan!

Works like a charm!