/// <summary> /// This function will decode any entities found in a string - not fast! /// </summary> internal static string DecodeEntities(string text) { return(HTMLentities.DecodeEntities(text)); }
public int Parse(string content, ArrayList lines) { lines.Clear(); result = lines; HtmlParser parser = new HtmlParser(); parser.SetChunkHashMode(true); parser.Init(content); parser.SetEncoding(System.Text.Encoding.UTF8); HTMLchunk chunk = null; Start(); while (!finished && (chunk = parser.ParseNext()) != null) { switch (chunk.oType) { case HTMLchunkType.OpenTag: HandleTag(chunk); break; case HTMLchunkType.CloseTag: HandleClosure(chunk.sTag); break; case HTMLchunkType.Text: offset = chunk.iChunkOffset; string text = ClearExtraBlanks(chunk.oHTML); text = HTMLentities.DecodeEntities(text); HandleWords(text); break; } } NewLine(true); if (!finished) { TextLine textLine = new TextLine(); /* Raffaele Russo - 19/04/2011 - Start - Modificato l'argomento del costruttore TextSegment, il quarto parametro * da "context.Font.Height" è stato modificato in "context.Font.GetHeight(96)" */ textLine.SetSegments(new ArrayList(line), context.Font.GetHeight(96)); // Raffaele Russo - 19/04/2011 - End textLine.Alignment = context.Alignment; if (height + textLine.Height <= bounds.Height) { result.Add(textLine); } previousLine = null; } byte[] b = new byte[parser.iCurPos]; Array.Copy(parser.bHTML, 0, b, 0, parser.iCurPos); int a = System.Text.Encoding.UTF8.GetString(b).Length; return(a); }