Display name expression for some Norwegian symbols


#1

Enonic version: 7.0.2
OS: Linux

We have a display name expression and it seems to break when we get some specific symbols in input.
This is our displayName script:
<display-name-expression>${NEWS_TITLE}</display-name-expression>
Here is the log:

Cannot evaluate script ["use strict";var NEWS_TITLE = 'Ugrasbekjemping viktig ved nyetablering av eng '; var NEWS_TYPE = 'REGULAR'; var NEWS_IMAGE_CAPTION = '<p>Foto: </p>
'; var NEWS_BYLINE_STRING = ''; var NEWS_INGRESS_SHORT = 'har sett på hvordan man kan få høy grovfôravling med minst mulig bruk av plantevernmidler. Det viktigste tiltaket bonden kan gjøre er å bekjempe ugras ved etablering av ny eng.'; var NEWS_INGRESS = 'har sett på hvordan man kan få høy grovfôravling med minst mulig bruk av plantevernmidler. Det viktigste tiltaket bonden kan gjøre er å bekjempe ugras ved etablering av ny eng.'; `${NEWS_TITLE}`.replace(/\s+/g, ' ')]. SyntaxError: Invalid or unexpected token
    at DisplayNameResolver.safeEval (bundle.js:1)
    at DisplayNameResolver.execute (bundle.js:1)
    at HTMLDivElement.<anonymous> (bundle.js:1)
DisplayNameResolver.safeEval @ bundle.js:1
DisplayNameResolver.execute @ bundle.js:1
(anonymous) @ bundle.js:1

#2

Which version of Content Studio are you on? This was fixed in the latest 2.0.3. See also Display name empty when using <display-name-expression> in a content-type that contains a HtmlArea input


#3

Hi!
We are using the latest Content Studio 2.0.3.


#4

Strange, I tested it with your text and didn’t get any errors… Can you share you content type schema?


#5

Hi!
Here is the content type:

<?xml version="1.0" encoding="UTF-8"?>
<content-type>
  <display-name>News</display-name>
  <display-name-expression>${NEWS_TITLE}</display-name-expression>
  <super-type>base:structured</super-type>
  <form>
    <input name="RELATED_LOCALE" type="ContentSelector">
      <label>News page in other languages</label>
      <occurrences minimum="0" maximum="1"/>
      <config>
        <relationshipType>system:reference</relationshipType>
        <allowPath>*</allowPath>
        <allowContentType>news</allowContentType>
      </config>
    </input>
    <input type="TextArea" name="NEWS_TITLE">
      <label>Title</label>
      <occurrences minimum="1" maximum="1"/>
    </input>
    <input type="ComboBox" name="NEWS_TYPE">
      <label>News Type</label>
      <occurrences minimum="1" maximum="1"/>
      <config>
        <option value="FEATURED">Featured</option>
        <option value="REGULAR">Regular</option>
        <option value="MINOR">Minor</option>
      </config>
    </input>
    <input type="ImageSelector" name="NEWS_IMAGE">
      <label>Main image</label>
      <occurrences minimum="1" maximum="1"/>
    </input>
    <input type="HTMLArea" name="NEWS_IMAGE_CAPTION">
      <label>Image caption</label>
      <occurrences minimum="0" maximum="1"/>
    </input>
    <input name="NEWS_BYLINE" type="ContentSelector">
      <label>News byline content selector</label>
      <occurrences minimum="0" maximum="1"/>
      <config>
        <relationshipType>system:reference</relationshipType>
        <allowPath>*</allowPath>
        <allowContentType>employee</allowContentType>
      </config>
    </input>
    <input name="NEWS_BYLINE_STRING" type="TextLine">
      <label>News byline string</label>
    </input>
    <input type="TextArea" name="NEWS_INGRESS_SHORT">
      <label>Forsideingress</label>
      <occurrences minimum="0" maximum="1"/>
    </input>
    <input type="TextArea" name="NEWS_INGRESS">
      <label>Ingress</label>
      <occurrences minimum="1" maximum="1"/>
    </input>
    <input name="NEWS_CONTACT" type="ContentSelector">
      <label>Contact</label>
      <occurrences minimum="0" maximum="0"/>
      <config>
        <relationshipType>system:reference</relationshipType>
        <allowPath>*</allowPath>
        <allowContentType>employee</allowContentType>
      </config>
    </input>
    <input name="RELATED_PUBLICATIONS" type="ContentSelector">
      <label>Related publications</label>
      <occurrences minimum="0" maximum="0"/>
      <config>
        <relationshipType>system:reference</relationshipType>
        <allowPath>*</allowPath>
        <allowContentType>publication</allowContentType>
      </config>
    </input>
    <input name="RELATED_PROJECTS" type="ContentSelector">
      <label>Related projects</label>
      <occurrences minimum="0" maximum="0"/>
      <config>
        <relationshipType>system:reference</relationshipType>
        <allowPath>*</allowPath>
        <allowContentType>project</allowContentType>
      </config>
    </input>
    <input name="RELATED_NEWS" type="ContentSelector">
      <label>Related news</label>
      <occurrences minimum="0" maximum="0"/>
      <config>
        <relationshipType>system:reference</relationshipType>
        <allowPath>*</allowPath>
        <allowContentType>news</allowContentType>
      </config>
    </input>
    <mixin name="tags"/>
  </form>
</content-type>