Hi,

I have a model, which has a field with type string().
Sometimes, when I paste something in the form field
from another site, I get signs:
'line separator' U+2028 (8232 decimal) and
'paragraph separator' U+2029 (8233 decimal).
Those signs cause ILLEGAL TOKEN error in javascript,
so I wanted to use erlydtl escapejs filter to prevent it.

Line separator character is represented as a binary in following way:
<<226,128,168>>
binary_to_list(<<226,128,168>>) = [226,128,168],

To properly handle line separator and paragraph separator,
escapejs requires list of characters, which contains integer 8232,
so string type should use unicode:characters_to_list/1 before passing the 
value to erlydtl
unicode:characters_to_list(<<226,128,168>>) = [8232].

My question is:
Where should I look for the binary_to_list/1, that I want to replace with 
unicode:characters_to_list/1?
Does this translation occur in:
* boss_db database adapter (I use postgres),
* somewhere higher in boss_db
* or somewhere in boss application?

Currently I solved the problem by removing type annotation,
which causes retrieving values as a binary
and then I modified erlydtl to use unicode:characters_to_list/1
before passing values to escapejs filter.

But I really, really like type annotations :)

P.S.
I love Chicago Boss - best framework ever :D

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to