You should use dwt to publish the code on the server, I mean create a new dwt for each code and just paste the code into dwt. you can use this dwt with component component or resource type.
or if you want to use a text field, try running the tbb code. add this tbb to the end of the template.
public override void Transform(Engine engine, Package package) { Regex objExp = new Regex(@"&#\d+;", RegexOptions.IgnoreCase); Regex objDecExp = new Regex(@"[^0-9]", RegexOptions.IgnoreCase); this.Initialize(engine, package); string strPackage = package.GetValue("Output"); strPackage = unescapeHTML(strPackage); strPackage = objExp.Replace(strPackage, delegate (Match match) { string strInput = match.ToString(); strInput = objDecExp.Replace(strInput, ""); int intValue = Convert.ToInt32(strInput); char strChar = (char)intValue; return strChar.ToString(); }); strPackage = strPackage.Trim(); Item objOutput = package.CreateStringItem(ContentType.Html, strPackage); package.PushItem("Output", objOutput); } private string unescapeHTML(string strInput) { StringBuilder strOutput = new StringBuilder(strInput); strOutput.Replace(""", """); strOutput.Replace(" ", " "); strOutput.Replace("&", "&"); strOutput.Replace("'", "'"); strOutput.Replace("<", "<"); strOutput.Replace(">", ">"); strOutput.Replace("¡", "¡"); strOutput.Replace("¢", "¢"); strOutput.Replace("£", "£"); strOutput.Replace("¤", "¤"); strOutput.Replace("¥", "¥"); strOutput.Replace("¦", "¦"); strOutput.Replace("§", "§"); strOutput.Replace("¨", "¨"); strOutput.Replace("©", "©"); strOutput.Replace("ª", "ª"); strOutput.Replace("¬", "¬"); strOutput.Replace("­", "­"); strOutput.Replace("®", "®"); strOutput.Replace("¯", "¯"); strOutput.Replace("°", "°"); return strOutput.ToString(); } }
source share