P4DTI issue job000195

TitleKeyword translation is too conservative
Statusclosed
Priorityessential
Assigned userNick Barnes
OrganizationRavenbrook
DescriptionWe translate keywords (items for Perforce job fields of type 'word') by using a hexadecimal escape %xx for characters other than [a-zA-Z0-9(),.?!-]. This is very conservative, and rules out a number of characters commonly used in defect trackers.
We also translate the space character ' ' into the underscore character '_'. This has the problem that we do not escape underscores, so underscores in a defect tracker become underscores in Perforce and then translate back to spaces.
We need a translator which is (a) bijective, (b) less conservative, and hopefully (c) less obfuscating.
AnalysisExperimentation with p4/p4d 2000.2 on swan (Linux) shows that all characters except the following are accepted in 'word' fields: hash (#), double quote ("), semicolon (;), slash (/) and whitespace (sp, ht, nl, vt, np, cr).
We could allow all other characters through untranslated, except for an escape character (e.g. '\'). However, ' ' may be common enough to translate to another character (e.g. '_' or '-'). It would be nice if we could have fairly clear translations for space, semicolon, and slash, as these characters are likely to occur in defect tracker fields.
Suggestion:
' ' -> '_'
'_' -> '\_'
'\' -> '\\'
';' -> '\:'
'/' -> '\|'
'#' -> '\='
'"' -> "\'"
 c -> '\xab' (hex translation for whitespace)
Done this, and moved translator to p4.py as it is p4-specific and not dt-specific. It's a translator class of its own.
How foundcustomer
Evidencedt_teamtrack.translate_keyword_tt_to_p4(),
dt_bugzilla.translate_keyword_bz_to_p4(),
<URL: http://info.ravenbrook.com/mail/2001/02/06/11-10-20/0.txt>
Observed in0.5.1
Test procedure<http://www.ravenbrook.com/project/p4dti/master/test/test_translator.py>
Created byNick Barnes
Created on2001-02-06 15:50:57
Last modified byGareth Rees
Last modified on2001-12-10 19:22:17
History2001-02-06 NB Created
2001-02-19 GDR Downgraded to optional.

Fixes

Change Effect Date User Description
8721 closed 2001-02-19 16:43:14 Nick Barnes Moved keyword translator to p4.py (job000195 for teamtrack).
8720 open 2001-02-19 16:30:16 Nick Barnes Fix omission in keyword translation.
8718 open 2001-02-19 16:17:33 Nick Barnes Keyword translation.