3

We have a schema with a non-RTF text field and we need to enter super-scripted characters for example: special symbols like register, trademark etc.

I am trying to figure out all possible (or in fact some innovative) ways to manage this without changing the schema (and making the field RTF) or introducing a C# TBB (to parse some character in the field and produce output).

One way I can think of putting tags (or some other delimitter), and managing it in the client side javascript - can some else tell me some other nice ways to do this?

UPDATE

I do not have a problem in putting a symbol in the text field but to make them appear in the super script.

3
  • What exactly is the problem outputting then? What do you have in the field as a character and what output do you get (and what would you like/need as an output)? Sep 23, 2013 at 12:57
  • Why can't you change the schema and is the superscript requirement within the CM or just on rendered output? Sep 23, 2013 at 17:54
  • Just want to avoid schema change as this will require a long approval process. The requirement is just on the rendered output. Sep 24, 2013 at 6:08

5 Answers 5

5

Well, so you're not really looking for "superscript" as a tag (<sup>) with some semantic meaning. A plain text field can't accommodate this without the character-parsing hack you're trying to avoid unless you're looking to extend the text field itself.

For just changing display in the CME, consider changing the system-wide font that already displays symbols higher.

If you can get past the requirement to not change schemas, you can allow symbols and superscript, while preventing other options. Compared to what authors do in other systems (i.e. word processors), rich text would be a good fit for authors to insert symbols and make them superscript when desired.

I've suggested it's a good idea to avoid custom XML, but don't fight rich text when it's really rich text. It's worth confirming how authors make their symbols, especially if they're trying to copy-and-paste rich text from a document.

1
  • It looks (and makes sense as well) that the best possible way is to make the field to handle rich text and no other straight fwd method is there Sep 24, 2013 at 6:24
5

Keep in mind that a normal text field is not designed to contain HTML entities, but UTF-8 characters should be fine, provided that you make sure the encoding is setup correctly in both the CM and CD side.

Then as to how you get these characters in there, well you could explain your editors how to work with ALT codes or have them use the Windows character map, but if you would like to provide something like the Special Characters popup in the RTF field, then you can use Custom URLs (requires login) for that.

I've created an example on how to use Custom URLs to select items from the SDL Tridion navigation tree on SDL Tridion World. You can perhaps use that as a base, but since you can probably get away with a simple hardcoded list of characters in there, it is going to be a lot easier.

See below for a very simple example of such a Custom URL page. Keep in mind since this page is using UTF-8 encoded characters (extended ASCII values), the HTML file must be saved as UTF-8 for it to work correctly.

<html>
<head>
  <title>Insert a Character</title>
  <script type="text/javascript" language="javascript" src="/WebUI/Core/Controls/Popup/PopupInit.js"></script>
  <script type="text/javascript" language="javascript">
    function insertValue(value) {
      var fields = window.dialogArguments.getFields();
      if (fields && fields.length > 0) {
        var content = '';
        if (fields[0].getValues() != null && 
            fields[0].getValues()[0] != null && 
            fields[0].getValues()[0].length > 0) {
          content = fields[0].getValues()[0];
        }
        fields[0].setValues([content + value]);
        window.close();
      }
    }
  </script>
</head>
<body>
  <h1>Please choose a Character to insert</h1>
  <ul>
    <li><a href="javascript:insertValue('é')">Insert é</a></li>
    <li><a href="javascript:insertValue('á')">Insert á</a></li>
  </ul>
</body>
</html>
1
  • Thanks Bart. I have updated my question. I do not have a problem in putting a symbol in the text field but to make them appear in the super script. Sep 23, 2013 at 12:47
4

In Windows simply use the Character Map (Start->Prigrams->Accessories). This tool is specifically there for scenarios like yours. Select your special char in the tool, copy-paste into any regular text field.

Here are the details: http://windows.microsoft.com/en-ca/windows-vista/using-special-characters-character-map-frequently-asked-questions#

1
  • Thanks Nick. I have updated my question. I do not have a problem in putting a symbol in the text field but to make them appear in the super script. Even symbols like Register, Trademark can be directly copy in the text fields of the components Sep 23, 2013 at 12:47
4

If you have a finite number of symbols, you could introduce a rudimentary templating convention.

A TBB that looks for specific character combinations and replaces them with the required markup for superscript symbols. You could store the "lookup" in a key-value pair component, so that it is content editable (if required).

For example finding '[R]' in the content, would result in a superscript registered trademark symbol being added in its place.

However, if it is more than a couple of pre-defined symbols, I would have to agree with @Alvin: "don't fight rich text when it's really rich text"

0
2

I suggest testing with the character described in Unicode as "2122 ™ TRADE MARK SIGN". Tridion should cope fine with you entering this in a component field - the easiest way is probably Alt + (Numeric keypad) 0153 on a Windows system.

The definition of this character in Unicode is that it is the equivalent of a superscript T followed by a superscript M. Of course, this will only display if you are using a font that has this character in its repertoire.

To test where this is going wrong, set everything to UTF-8, and use a byte editor such as http://mh-nexus.de/en/. Open up the published pages on the file system of your server, and verify that the TRADE MARK SIGN has been successfully written as the UTF-8 sequence "E2 84 A2". If this is so, then Tridion has done its job correctly.

Check that your browser is able to recognise the encoding correctly. A good check is to manually set the encoding to UTF-8 and see if the character is represented properly.

I've put some more detailed steps for debugging this kind of thing at http://www.dominic.cronin.nl/weblog/why-cant-i-get-my-special-characters-to-display-properly

1
  • Thanks Dominic, this is helpful. To add further, if we simply copy and paste a super scripted trademark symbol from web or ALT+0153, this will get copied in the super scripted manner in the text field, however, the same is not true for registered symbol Sep 24, 2013 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.