|No such thing as a small change|
Re^3: Convert HTML symbols to equivalent Unicodeby dorward (Curate)
|on Apr 15, 2009 at 10:01 UTC||Need Help??|
At this point you will either have the results of parsing HTML or you will have raw HTML.
This suggests you are dealing with parsed HTML, with any entities already converted to real characters.
In this case, there are two approaches you could take.
If you use a module designed for writing XML then you can just pass the ® and the module will output either a raw ® or a numeric entity for it. Any XML parser that this XML gets read by should be able to cope with either, so it doesn't matter which you end up with and you don't need to worry about it.
If you use a generic templating language, then you have to deal with using a raw ® or converting it with HTML::Entities::encode_numeric() or a similar module. Basically — you have to do all the things that a proper XML module would do for you.
It sounds like you are using a generic templating language, but it is almost certainly better to use a real XML module.
Afterthought: You might also be messing about with raw strings in the middle of your code. That way lies madness.