Return-Path: X-Original-To: apmail-freemarker-notifications-archive@minotaur.apache.org Delivered-To: apmail-freemarker-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 98A2518B6E for ; Mon, 14 Mar 2016 15:24:37 +0000 (UTC) Received: (qmail 15930 invoked by uid 500); 14 Mar 2016 15:24:37 -0000 Delivered-To: apmail-freemarker-notifications-archive@freemarker.apache.org Received: (qmail 15911 invoked by uid 500); 14 Mar 2016 15:24:37 -0000 Mailing-List: contact notifications-help@freemarker.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@freemarker.incubator.apache.org Delivered-To: mailing list notifications@freemarker.incubator.apache.org Received: (qmail 15902 invoked by uid 99); 14 Mar 2016 15:24:37 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Mar 2016 15:24:37 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 01CC0C7283 for ; Mon, 14 Mar 2016 15:24:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id vnjxK_C5_BMZ for ; Mon, 14 Mar 2016 15:24:34 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with SMTP id 3BDA45F3F1 for ; Mon, 14 Mar 2016 15:24:34 +0000 (UTC) Received: (qmail 15155 invoked by uid 99); 14 Mar 2016 15:24:33 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Mar 2016 15:24:33 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 9FE3C2C14F8 for ; Mon, 14 Mar 2016 15:24:33 +0000 (UTC) Date: Mon, 14 Mar 2016 15:24:33 +0000 (UTC) From: =?utf-8?Q?Martin_T=C4=9Bthal_=28JIRA=29?= To: notifications@freemarker.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (FREEMARKER-16) js_string buit-in function escapes '/' for first character MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FREEMARKER-16?page=3Dcom.atlass= ian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1= 5193468#comment-15193468 ]=20 Martin T=C4=9Bthal edited comment on FREEMARKER-16 at 3/14/16 3:23 PM: ------------------------------------------------------------------ In our solution it is not neccessary to escape those combinations. It is ve= ry similar to ?j_string where double-quotas are expected before and after String x =3D "${val?j_string}"; but when we need to use single-quotation for attributes (JSTL on some Java = EE servers needs only apostrophes for dynamic attributes) the string has to= escape both ' and ". myattribute=3D'<%=3D "This string ${has?j_string} to be escaped with both" = %>' As Java strings suports both \' and \" (https://docs.oracle.com/javase/tuto= rial/java/data/characters.html) my suggestion is to extend ?j_string to esc= ape both. was (Author: mtethal): In our solution it is not neccessary to escape those combinations. It is ve= ry similar to ?j_string where double-quotas are expected before an= d after String x =3D "${val?j_string}"; but when we need to use single-quotation for attributes (JSTL on some Java = EE servers needs only apostrophes for dynamic attributes) the string has to= escape both ' and ". myattribute=3D'<%=3D "This string ${has?j_string} to be escaped with bo= th" %>' As Java strings suports both \' and \" (https://docs.orac= le.com/javase/tutorial/java/data/characters.html) my suggestion is to exten= d ?j_string to escape both. > js_string buit-in function escapes '/' for first character > ---------------------------------------------------------- > > Key: FREEMARKER-16 > URL: https://issues.apache.org/jira/browse/FREEMARKER-16 > Project: Apache Freemarker > Issue Type: Bug > Components: engine > Affects Versions: 2.3.23 > Reporter: Martin T=C4=9Bthal > Assignee: Daniel Dekany > Priority: Minor > > ${"bar/foo"?js_string} returns "bar/foo" > but > ${"/foo"?js_string} returns "\/foo" (the first slash character is escaped= by backslash). > I think the problem is from version 2.3.1 as documentation says: > Starting from FreeMarker 2.3.1, it also escapes > as \> (to avoid ). -- This message was sent by Atlassian JIRA (v6.3.4#6332)