# Greater than sign in javascript script in Racket

**URL:** https://racket.discourse.group/t/greater-than-sign-in-javascript-script-in-racket/2385
**Category:** Questions & Answers
**Tags:** question
**Created:** [October 14, 2023, 5:48pm UTC](https://racket.discourse.group/t/greater-than-sign-in-javascript-script-in-racket/2385 "2023-10-14T17:48:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![hendrikboom3](https://avatars.discourse-cdn.com/v4/letter/h/b5e925/32.png) [@hendrikboom3](https://racket.discourse.group/u/hendrikboom3)
#### Post date: [October 14, 2023, 5:48pm UTC](https://racket.discourse.group/t/greater-than-sign-in-javascript-script-in-racket/2385/1 "2023-10-14T17:48:36Z")

</div>

I have trouble with the xexpr conversion of a script.  
I run a very simple case extracted from a much larger program:

```scheme
#lang web-server
    (require xml net/url)
(xexpr->string '(script "SetTimeOut(() => {let d = new Date();" ))

```

The result, run in drracket:

```scheme
"<script>SetTimeOut(() =&gt; {let d = new Date();</script>"

```

That \> should still be a greater-than sign. It is no longer correct javascript.  
A bug? Or am I doing it wrong?

---

<div class="post-metadata">

### Author: ![sorawee](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@sorawee](https://racket.discourse.group/u/sorawee)
#### Post date: [October 14, 2023, 6:12pm UTC](https://racket.discourse.group/t/greater-than-sign-in-javascript-script-in-racket/2385/2 "2023-10-14T18:12:49Z")

</div>

You can use [`html-unescaped-tags`](https://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fmain..rkt%29._html-unescaped-tags%29%29) to prevent the incorrect transformation.

---

<div class="post-metadata">

### Author: ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)
#### Post date: [October 14, 2023, 8:53pm UTC](https://racket.discourse.group/t/greater-than-sign-in-javascript-script-in-racket/2385/3 "2023-10-14T20:53:36Z")

</div>

The parameter `current-unescaped-tags` holds tags that needs unescaped contents.  
You need to set to `html-unescaped-tags`. If I recall correctly this was done  
to have backward compatibility with older code.

```scheme
(parameterize ([current-unescaped-tags html-unescaped-tags])
  (xexpr->string '(script "SetTimeOut(() => {let d = new Date();" )))

```

---

<div class="post-metadata">

### Author: ![joeld](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/joeld/32/38_2.png) [@joeld](https://racket.discourse.group/u/joeld)
#### Post date: [October 16, 2023, 2:52pm UTC](https://racket.discourse.group/t/greater-than-sign-in-javascript-script-in-racket/2385/4 "2023-10-16T14:52:39Z")

</div>

If you already happen to be using the `txexpr` package (or don't mind an extra dependency) it also includes a function [`xexpr->html`](https://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._xexpr-~3ehtml%29%29) that skips the content of `<script>` or `<style>` blocks.
