compiler icon indicating copy to clipboard operation
compiler copied to clipboard

Dangerous advice in optimize.md wrt Unicode

Open VulumeCode opened this issue 3 years ago • 2 comments

Quick Summary: Using a Unicode symbol like "↵" in an Elm string works fine. After following the uglifyjs advice in optimize.md it has encoding issues.

https://github.com/elm/compiler/blob/master/hints/optimize.md

It seems to work fine without mangling, but I don't trust it any further.

  • Elm: 19.1
  • Operating System: Win10

VulumeCode avatar Mar 09 '22 10:03 VulumeCode

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions in a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.

Finally, please be patient with the core team. They are trying their best with limited resources.

github-actions[bot] avatar Mar 09 '22 10:03 github-actions[bot]

Hi!

I tried to reproduce this (because I’m interested in minifying Elm code; I wrote https://discourse.elm-lang.org/t/what-i-ve-learned-about-minifying-elm-code/7632).

But I didn’t manage.

module Main exposing (main)

import Html

main = Html.text "↵"
<!doctype html>
<html lang="en">
<title>test</title>
<script src="elm.min.js"></script>
<div id="node1"></div>
<script>
  Elm.Uni.init({ node: node1 })
</script>

Followed the commands at https://github.com/elm/compiler/blob/39949053f9469862b17006e3965f3b440414d13c/hints/optimize.md#instructions

UglifyJS version 3.15.3.

The “↵” displays correctly both before and after minification.

Am I missing something? Do you have steps to reproduce?

lydell avatar Mar 11 '22 11:03 lydell