Exemplo n.º 1
0
        public Stream Format(XDoc doc)
        {
            var stream = new MemoryStream();

            PhpUtil.WritePhp(doc, stream, MimeType.PHP.CharSet);
            stream.Position = 0;
            return(stream);
        }
Exemplo n.º 2
0
        public void PhpSerialization3()
        {
            XDoc doc = new XDoc("test");

            doc.Value("<tag>ö</tag>");
            Encoding     encoding = Encoding.GetEncoding("ISO-8859-1");
            MemoryStream stream   = new MemoryStream();

            PhpUtil.WritePhp(doc, stream, encoding);
            byte[] text = stream.ToArray();
            Assert.IsTrue(ArrayUtil.Compare(encoding.GetBytes("a:1:{s:4:\"test\";s:12:\"<tag>ö</tag>\";}"), text) == 0);
        }