Comments (4)
the bug does not occur in unicode.
from mustache.sh.
The bug comes from the
sed -r "
s/./&\\n/g
s/\\\\/\\\\\\\\/g
"
as illustrated by doing (with iso-8859-1)
echo 'A=é
b=c' | sed -r "
s/./&\\n/g
s/\\\\/\\\\\\\\/g
"
from mustache.sh.
I poked around a bit with iconv
(1) (character sets are mysterious beasts and my shell loves UTF-8) and I think this confirms the issue. Note the extra 0a
in the UTF-8 version:
$ printf 'A=é\nB=c\n' | iconv -f UTF-8 -t UTF-8 | sed -r "
> s/./&\\n/g
> s/\\\\/\\\\\\\\/g
> " | hd
00000000 41 0a 3d 0a c3 a9 0a 0a 42 0a 3d 0a 63 0a 0a |A.=.....B.=.c..|
0000000f
$ printf 'A=é\nB=c\n' | iconv -f UTF-8 -t ISO_8859-1 | sed -r "
s/./&\\n/g
s/\\\\/\\\\\\\\/g
" | hd
00000000 41 0a 3d 0a e9 0a 42 0a 3d 0a 63 0a 0a |A.=...B.=.c..|
0000000d
$
I am not sure how to fix this, unfortunately.
from mustache.sh.
ostensibly it is a sed bug.
To do a bug report to sed I'd have to join their mailing list (not happening)
My current workaround is to replace the first sed usage by perl
perl -pe 's/([^\n])/\1\n/sg' | sed -r "s/\\\\/\\\\\\\\/g" | _mustache
but that change makes my mustache.sh not really .sh anymore
horrible, but works :/ I'll just live with that
from mustache.sh.
Related Issues (3)
- Encoding problems HOT 2
- Comments HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mustache.sh.