symbol font ≤, ≥, θ changes to £, ³, ē, ĕ

My dxl script runs thru the module and adds ReqId (e.g. SP340) in front of the Object Text. During this process, the object text is loaded into a buffer in RichText format.
string ot = richTextWithOle(o.TEXT_ATT)

The following problem is encountered:

-The following symbols are changing from the symbol font ≤, ≥, θ, and σ to the arial counter-parts £, ³, ē, ĕ respectively when the Add Remove ReqID dxl is run to add the requirement ID.

-Not every occurrence of the above symbols (≤, ≥, θ, and σ ) are changed when the Add Remove ReqID dxl to add the requirement ID is run

I have not been able to identify what's different when they do change versus when they don't change

Any help is appreciated.

Thanks,

FZ
faisal.zahidi@boeing.com - Wed Sep 22 15:47:24 EDT 2010

Re: symbol font ≤, ≥, θ changes to £, ³, ē, ĕ
Peter_Albert - Thu Sep 23 02:55:40 EDT 2010

I guess the requirements have been imported from MS Word?

There are several ways to add e.g. the ≤ symbol in a Word file, it can be part of the font, or it can be added as a symbol. IIRC, it must a symbol if it is expected to behave properly in DOORS; if it is part of the font table, it creates the results you observed.

As a first test I suggest that you copy / paste one of the symbols into the DXL window and run

char c ='≤'
print intOf c

. Do this with one symbol which works fine, and with another which doesn't, and you should see different results.

A second test would be to run the attached dxl against the problematic Object. It displays all rich text chunks in the Object Text, and normally, each symbol should appear in a row in itself, showing it as a symbol. I bet that in your case it doesn't.

Now, if that is the case, then you could probably write some DXL to fix the wrong symbols, but it is not fully trivial, as you have to add the symbol rich text into the Object Text.

For the future, you can run the Word macro below against Word files to be imported. It replaces all characters which I have found to be problematic so far by their unproblematic counterparts.
 

Sub replace_special_characters()
'
'
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    With Selection.Find
        .Text = ChrW(64256)
        .Replacement.Text = "ff"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64257)
        .Replacement.Text = "fi"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64258)
        .Replacement.Text = "fl"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64259)
        .Replacement.Text = "ffi"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64260)
        .Replacement.Text = "ffl"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64261)
        .Replacement.Text = "ft"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(730)
        .Replacement.Text = "°"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(8804)
        .Replacement.Text = ChrW(61603)
        .Replacement.Font.Name = "Symbol"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(8805)
        .Replacement.Text = ChrW(61619)
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(693)
        .Replacement.Text = "s"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
 
End Sub

 


Regards,

Peter

 

Re: symbol font ≤, ≥, θ changes to £, ³, ē, ĕ
Peter_Albert - Thu Sep 23 02:58:30 EDT 2010

Peter_Albert - Thu Sep 23 02:55:40 EDT 2010

I guess the requirements have been imported from MS Word?

There are several ways to add e.g. the ≤ symbol in a Word file, it can be part of the font, or it can be added as a symbol. IIRC, it must a symbol if it is expected to behave properly in DOORS; if it is part of the font table, it creates the results you observed.

As a first test I suggest that you copy / paste one of the symbols into the DXL window and run

char c ='≤'
print intOf c

. Do this with one symbol which works fine, and with another which doesn't, and you should see different results.

A second test would be to run the attached dxl against the problematic Object. It displays all rich text chunks in the Object Text, and normally, each symbol should appear in a row in itself, showing it as a symbol. I bet that in your case it doesn't.

Now, if that is the case, then you could probably write some DXL to fix the wrong symbols, but it is not fully trivial, as you have to add the symbol rich text into the Object Text.

For the future, you can run the Word macro below against Word files to be imported. It replaces all characters which I have found to be problematic so far by their unproblematic counterparts.
 

Sub replace_special_characters()
'
'
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    With Selection.Find
        .Text = ChrW(64256)
        .Replacement.Text = "ff"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64257)
        .Replacement.Text = "fi"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64258)
        .Replacement.Text = "fl"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64259)
        .Replacement.Text = "ffi"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64260)
        .Replacement.Text = "ffl"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64261)
        .Replacement.Text = "ft"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(730)
        .Replacement.Text = "°"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(8804)
        .Replacement.Text = ChrW(61603)
        .Replacement.Font.Name = "Symbol"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(8805)
        .Replacement.Text = ChrW(61619)
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(693)
        .Replacement.Text = "s"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
 
End Sub

 


Regards,

Peter

 

Hm, it seems as if I failed to attach the rich Text DXL. I'll try again and also paste it below.

Regards,

Peter

// Show all rich text elements of the current Object Text
/*
*/
const string emptyString[] = {""}
DB baseDB       = create  ("Explore Rich Text")
DBE listDBE     = listView(baseDB, 0, 850, 10, emptyString)
DBE richTextDBE = richText(baseDB, "", "", 850, 100, true)
DBE textDBE     = text    (baseDB, "", "", 850, 100, true)
void showRTF(DB db)
{ // Show all rich text elements
  empty listDBE
  Object o = current
  string s = richTextWithOle o."Object Text"
  if (s == ""){s = richTextWithOle o."Object Heading"}
  RichTextParagraph rp
  RichText rt
  int irp = 0, irt = 0, i
  set(richTextDBE, s)
  set(textDBE, s)
  for rp in s do
  { // Loop through rich text paragraphs
    irt = 0
    for rt in rp do
    { // Loop through rich text chunks
      i = 1
      int row = noElems(listDBE)
      insert(listDBE, row, irp "")
      set   (listDBE, row, i++, rp.text)
      set   (listDBE, row, i++, (length rp.text) "")
      set   (listDBE, row, i++, rp.indentLevel "")
      set   (listDBE, row, i++, rp.isBullet    ? "X" : "")
      set   (listDBE, row, i++, irt "")
      set   (listDBE, row, i++, rt.text)
      set   (listDBE, row, i++, (length rt.text) "")
      set   (listDBE, row, i++, rt.isOle       ? "X" : "")
      set   (listDBE, row, i++, rt.newline     ? "X" : "")
      set   (listDBE, row, i++, rt.last        ? "X" : "")
      set   (listDBE, row, i++, rt.bold        ? "X" : "")
      set   (listDBE, row, i++, rt.italic      ? "X" : "")
      set   (listDBE, row, i++, rt.underline   ? "X" : "")
      set   (listDBE, row, i++, rt.strikethru  ? "X" : "")
      set   (listDBE, row, i++, rt.subscript   ? "X" : "")
      set   (listDBE, row, i++, rt.superscript ? "X" : "")
      set   (listDBE, row, i++, rt.isUrl       ? "X" : "")
      set   (listDBE, row, i++, rt.charset "")
      irt++
    } // Loop through rich text chunks
    irp++
  } // Loop through rich text paragraphs
} // Show all rich text elements
apply(baseDB, "Show", showRTF)
realize baseDB
 
int i = 0
insertColumn(listDBE, i++, "#rp"           , 50, iconNone)
insertColumn(listDBE, i++, "rp.text"       , 50, iconNone)
insertColumn(listDBE, i++, "rp.length"     , 50, iconNone)
insertColumn(listDBE, i++, "rp.indentLevel", 50, iconNone)
insertColumn(listDBE, i++, "rp.isBullet"   , 50, iconNone)
insertColumn(listDBE, i++, "#rt"           , 50, iconNone)
insertColumn(listDBE, i++, "rt.text"       , 50, iconNone)
insertColumn(listDBE, i++, "rt.length"     , 50, iconNone)
insertColumn(listDBE, i++, "rt.isOle"      , 50, iconNone)
insertColumn(listDBE, i++, "rt.newline"    , 50, iconNone)
insertColumn(listDBE, i++, "rt.last"       , 50, iconNone)
insertColumn(listDBE, i++, "rt.bold"       , 50, iconNone)
insertColumn(listDBE, i++, "rt.italic"     , 50, iconNone)
insertColumn(listDBE, i++, "rt.underline"  , 50, iconNone)
insertColumn(listDBE, i++, "rt.strikethru" , 50, iconNone)
insertColumn(listDBE, i++, "rt.subscript"  , 50, iconNone)
insertColumn(listDBE, i++, "rt.superscript", 50, iconNone)
insertColumn(listDBE, i++, "rt.isUrl"      , 50, iconNone)
insertColumn(listDBE, i++, "rt.charset"    , 50, iconNone)
showRTF(baseDB)
show baseDB

Re: symbol font ≤, ≥, θ changes to £, ³, ē, ĕ
Peter_Albert - Thu Sep 23 02:58:30 EDT 2010

Peter_Albert - Thu Sep 23 02:55:40 EDT 2010

I guess the requirements have been imported from MS Word?

There are several ways to add e.g. the ≤ symbol in a Word file, it can be part of the font, or it can be added as a symbol. IIRC, it must a symbol if it is expected to behave properly in DOORS; if it is part of the font table, it creates the results you observed.

As a first test I suggest that you copy / paste one of the symbols into the DXL window and run

char c ='≤'
print intOf c

. Do this with one symbol which works fine, and with another which doesn't, and you should see different results.

A second test would be to run the attached dxl against the problematic Object. It displays all rich text chunks in the Object Text, and normally, each symbol should appear in a row in itself, showing it as a symbol. I bet that in your case it doesn't.

Now, if that is the case, then you could probably write some DXL to fix the wrong symbols, but it is not fully trivial, as you have to add the symbol rich text into the Object Text.

For the future, you can run the Word macro below against Word files to be imported. It replaces all characters which I have found to be problematic so far by their unproblematic counterparts.
 

Sub replace_special_characters()
'
'
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    With Selection.Find
        .Text = ChrW(64256)
        .Replacement.Text = "ff"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64257)
        .Replacement.Text = "fi"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64258)
        .Replacement.Text = "fl"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64259)
        .Replacement.Text = "ffi"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64260)
        .Replacement.Text = "ffl"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(64261)
        .Replacement.Text = "ft"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(730)
        .Replacement.Text = "°"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(8804)
        .Replacement.Text = ChrW(61603)
        .Replacement.Font.Name = "Symbol"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(8805)
        .Replacement.Text = ChrW(61619)
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = ChrW(693)
        .Replacement.Text = "s"
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
 
End Sub

 


Regards,

Peter

 

Hm, it seems as if I failed to attach the rich Text DXL. I'll try again and also paste it below.

Regards,

Peter

// Show all rich text elements of the current Object Text
/*
*/
const string emptyString[] = {""}
DB baseDB       = create  ("Explore Rich Text")
DBE listDBE     = listView(baseDB, 0, 850, 10, emptyString)
DBE richTextDBE = richText(baseDB, "", "", 850, 100, true)
DBE textDBE     = text    (baseDB, "", "", 850, 100, true)
void showRTF(DB db)
{ // Show all rich text elements
  empty listDBE
  Object o = current
  string s = richTextWithOle o."Object Text"
  if (s == ""){s = richTextWithOle o."Object Heading"}
  RichTextParagraph rp
  RichText rt
  int irp = 0, irt = 0, i
  set(richTextDBE, s)
  set(textDBE, s)
  for rp in s do
  { // Loop through rich text paragraphs
    irt = 0
    for rt in rp do
    { // Loop through rich text chunks
      i = 1
      int row = noElems(listDBE)
      insert(listDBE, row, irp "")
      set   (listDBE, row, i++, rp.text)
      set   (listDBE, row, i++, (length rp.text) "")
      set   (listDBE, row, i++, rp.indentLevel "")
      set   (listDBE, row, i++, rp.isBullet    ? "X" : "")
      set   (listDBE, row, i++, irt "")
      set   (listDBE, row, i++, rt.text)
      set   (listDBE, row, i++, (length rt.text) "")
      set   (listDBE, row, i++, rt.isOle       ? "X" : "")
      set   (listDBE, row, i++, rt.newline     ? "X" : "")
      set   (listDBE, row, i++, rt.last        ? "X" : "")
      set   (listDBE, row, i++, rt.bold        ? "X" : "")
      set   (listDBE, row, i++, rt.italic      ? "X" : "")
      set   (listDBE, row, i++, rt.underline   ? "X" : "")
      set   (listDBE, row, i++, rt.strikethru  ? "X" : "")
      set   (listDBE, row, i++, rt.subscript   ? "X" : "")
      set   (listDBE, row, i++, rt.superscript ? "X" : "")
      set   (listDBE, row, i++, rt.isUrl       ? "X" : "")
      set   (listDBE, row, i++, rt.charset "")
      irt++
    } // Loop through rich text chunks
    irp++
  } // Loop through rich text paragraphs
} // Show all rich text elements
apply(baseDB, "Show", showRTF)
realize baseDB
 
int i = 0
insertColumn(listDBE, i++, "#rp"           , 50, iconNone)
insertColumn(listDBE, i++, "rp.text"       , 50, iconNone)
insertColumn(listDBE, i++, "rp.length"     , 50, iconNone)
insertColumn(listDBE, i++, "rp.indentLevel", 50, iconNone)
insertColumn(listDBE, i++, "rp.isBullet"   , 50, iconNone)
insertColumn(listDBE, i++, "#rt"           , 50, iconNone)
insertColumn(listDBE, i++, "rt.text"       , 50, iconNone)
insertColumn(listDBE, i++, "rt.length"     , 50, iconNone)
insertColumn(listDBE, i++, "rt.isOle"      , 50, iconNone)
insertColumn(listDBE, i++, "rt.newline"    , 50, iconNone)
insertColumn(listDBE, i++, "rt.last"       , 50, iconNone)
insertColumn(listDBE, i++, "rt.bold"       , 50, iconNone)
insertColumn(listDBE, i++, "rt.italic"     , 50, iconNone)
insertColumn(listDBE, i++, "rt.underline"  , 50, iconNone)
insertColumn(listDBE, i++, "rt.strikethru" , 50, iconNone)
insertColumn(listDBE, i++, "rt.subscript"  , 50, iconNone)
insertColumn(listDBE, i++, "rt.superscript", 50, iconNone)
insertColumn(listDBE, i++, "rt.isUrl"      , 50, iconNone)
insertColumn(listDBE, i++, "rt.charset"    , 50, iconNone)
showRTF(baseDB)
show baseDB