Ticket #901 (new enhancement)

SVN Diffs for #901

 

Opened 8 years ago

Last modified 1 year ago

Standardizing how escaping works.

Reported by: alan(at)finwhale.com Assigned to: andy
Priority: trivial Milestone: UNSCH
Component: others Version: 1.7
Keywords: others Cc:
Load: Xref: 3321
Java Version: Operating System: all
Project (C/J): all Weeks: 1
Review:

Description

BACKGROUND

Several components of ICU4C/J are data driven. They take patterns (short strings, less than a line of text) or rules (typically one or more lines of text) that parameterize them. Examples are SimpleDateFormat, DecimalFormat, RuleBasedCollator, RuleBasedTransliterator, RuleBasedBreakIterator, and other classes. In these rules, a class of characters ('specials') must be escaped or quoted if they are to be used as literals. Quoting mechanisms include single quotes and backslash escapes (including \uXXXX).

Rule-based components typically return their rule string via methods such as toPattern(), getRules(), etc. The returned string should be directly usable to create new objects equivalent to the originals. For this to work, special characters must be escaped in the returned rule string.

RFE

Add a quoting function that escapes and/or quotes special characters. This function should take a string, a set of characters that need quoting, and return the quoted string.

C

/**

  • Quote specials in-place. Return actual length (may be > capacity).
  • @param specials set of characters that need quoting */

int32_t u_quoteSpecials(UChar* string, int32_t length, int32_t capacity,

UUnicodeSet* specials);

This might be a little cleaner:

/**

  • Quote specials. Return result length (may be > capacity). */

int32_t u_quoteSpecials(const UChar* string, int32_t length,

UChar* result, int32_t resultCapacity, UUnicodeSet* specials);

Java

/**

  • Quote specials. */

UnicodeString quoteSpecials(UnicodeString string,

UnicodeSet specials);

Attachments

Change History

12/31/69 17:41:28 changed by notes2

Make quotation symbols, whitespace handling, escapes the same in all parsers (rules & patterns). Maybe add utility functions.

12/31/69 17:41:29 changed by auditor

  • Thu May 17 13:47:08 2001 schererm moved from incoming to feature
  • 03/21/02 13:05:32 schererm moved from feature to others
  • 08/28/02 20:21:56 weiv changed notes2
  • 08/29/02 18:01:55 mohan changed notes2
  • 08/30/02 16:31:23 hshih changed notes2
  • 10/09/02 18:39:36 synwee changed notes2
  • 10/28/02 17:56:48 schererm changed notes2
  • 12/26/02 18:39:07 hshih changed notes2
  • 05/30/03 11:35:36 hshih changed notes2
  • 12/09/03 16:44:30 schererm changed notes2
  • 12/09/03 16:46:52 schererm changed notes2
  • 02/06/04 13:01:26 andy changed notes2
  • 02/17/04 20:06:24 weiv changed notes2
  • 07/19/04 18:41:04 schererm changed notes2
  • Thu Oct 12 23:14:21 2006 grhoten changed notes2: priority: "high" to "small", summmary: "" to "RFE: Standardizing how escaping works.", xref: "3321, standardizing how escaping works." to "3321",

09/28/07 12:26:46 changed by andy

  • load changed.
  • project set to all.
  • java changed.
  • revw changed.
  • summary changed from RFE: Standardizing how escaping works. to Standardizing how escaping works..

Add/Change #901 (Standardizing how escaping works.)




Anti spam check: