3

When ever enter decimal code in RTF source tab and click on design tab, it is getting converted to sign symbol in both source and design tabs.

For example, entered decimal code ✓ in source tab and checked it in design tab. It is showing the output as ✓ sign in design tab. When checked the same in source tab, there also it is showing ✓ sign instead of entered ✓ decimal code.

We require decimal code as is in source tab because this code is used in some other tool to perform certain operations.

We are using this in Tridion 2013 SP1 version.

  • Maybe it's just me, but it looks like StackExchange is doing the exact same thing with your decimal code... – Nuno Linhares Mar 11 '15 at 18:14
6

The Tridion Rich Text Field stores unicode characters using an encoding that it manages internally (I believe it's something like UTF-16), and then it converts the characters to an HTML-compliant encoding based on what you have set on your Publication Target. As you have noticed, in some scenarios this isn't what we want.

However, also do notice that this website's editing dialog (stackexchange) did the same thing to your decimal symbol. In your question I just see the checkbox listed and not the decimal. So this is very common behaviour of WYSIWYG HTML editors.

If your external tool is using published output of the component you can solve the issue with the options below:

1) make sure that the encoding on the Publishing Target is set correctly: enter image description here

2) If 1 above doesn't solve it, then write a simple TBB which does a string replace with the character you want. The TBB should take your Package.Output variable and do a String.Replace("<unwanted_char>", "<wanted char>");

If your tool is connecting to Tridion via the Core Service, then you might need to get that tool to do the character replace on Tridion's returned XML, or ensure that it consuming the XML with the right encoding.

4

Look carefully at your design. It strikes me that you are approaching this in the wrong way. The point is that a Rich Text field is meant for allowing rich text editing by an end user. If you are hand-editing the source tab, that's already a sign that something's adrift. Tridion is a web content management system, so it won't surprise anyone to find that it's focused on producing web content. So when you tell us:

We require decimal code as is in source tab because this code is used in some other tool to perform certain operations.

I'm already thinking that this is like going to ferrari.stackexchange.com and asking why you can't get half a ton of potatoes in the back.

I'll assume that you have a good reason for wanting to produce specific code in your output. The question is - why are you using an RTF for this? An RTF is focused on Rich text editing - and your output will be transformed. If you want to create literal text output - that's very easy. Use a text field, and arrange for it to be edited by people who can be trusted to put the desired characters one after the other in the correct order.

In order to execute the XSLT transform, the XML of your Rich Text field is loaded into an XML Dom. There's no way round this. The XSLT actually executes against the in-memory representation of the XML document, so by the time it runs, the 'decimal' serialisation of your character is already gone.

The problem then is how to ensure that your character is detected and output as you desire in the serialised output from your XSLT. It turns out that XSLT 2.0 has specific support for this problem, so you should look at character maps to see if they will work for you. I don't know a way to do this in XSLT 1.0, so if there's a reason why you have to use that, then Nick's suggestion of doing the replacement afterwards is a good one.

0

I recommend you use a plain text field to store and emit code. Rich text fields do an interpretation of what you are typing in by on-the-fly loading it into a DOM and transforming it with XSLT.

Alternatively you could encode the output using a custom TBB (where you HTML encode any non-ascii output character or maybe just this one specifically using its &#xxxx; representation) which you add to the compound chain after your DWT renders the HTML output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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