đấy là bạn gửi dữ liệu theo encoding là UTF-8. Có lẽ forum đó để mặc định Encoding là ISO-8859-1 . Bằng firefox bạn vào View-->Character Encoding-->UTF-8 thì font sẽ bình thường
Hình đang viết một phần mềm tự động viết bài lên forum mình đã thành công rồi như bị lỗi kiểu chữ nó lỗi vầy
đây là đoạn code của mình
Visual C# Code:
string s = string.Format("encoding=UTF-8&prefixid=1&subject={0}&AVIMMethod=on&message={1}&wysiwyg=1&taglist=&iconid=0&s=&securitytoken={2}&f={3}&do=postthread&posthash={4}&poststarttime={5}&loggedinuser={6}&sbutton=G%E1%BB%ADi+b%C3%A0i+m%E1%BB%9Bi&signature=1&parseurl=1&emailupdate=9999&polloptions=4", HttpUtility.UrlEncode( txtLieude.Text.Trim()), //subject HttpUtility.UrlEncode(txtNoiDung.Text.Trim()), //message securitytoken, //securitytoken forumid, //f posthash, //posthash poststarttime, //poststarttime loggedinuser //loggedinuser ); HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(requestUriString); httpWebRequest.Method = "POST"; httpWebRequest.CookieContainer = cookieCache; httpWebRequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; httpWebRequest.Headers.Add("Content-Transfer-Encoding", "binary"); Stream requestStream = httpWebRequest.GetRequestStream(); requestStream.Write(bytes, 0, bytes.Length); requestStream.Close(); HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); StreamReader reader = new StreamReader(httpWebResponse.GetResponseStream(), System.Text.Encoding.UTF8);
ai có kinh nghiệp hướng dẫn mình vấn đề này với
Đã được chỉnh sửa lần cuối bởi vantrung87hvt : 11-09-2011 lúc 01:14 AM.
đấy là bạn gửi dữ liệu theo encoding là UTF-8. Có lẽ forum đó để mặc định Encoding là ISO-8859-1 . Bằng firefox bạn vào View-->Character Encoding-->UTF-8 thì font sẽ bình thường
Trước đây mình cũng có viết 1 cái post bài lên các forum vbulletin, bạn thử xem lại ContentType xem
Đây là đoạn của mình
Visual C# Code:
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(collectionLink.Address + "newthread.php?do=newthread&f=" + collectionLink.Fid.ToString()); httpWebRequest.Method = "POST"; httpWebRequest.ContentType = "application/x-www-form-urlencoded"; httpWebRequest.ContentLength = data.Length; httpWebRequest.CookieContainer.Add(cc); { // Send the data Stream newStream = httpWebRequest.GetRequestStream(); newStream.Write(data, 0, data.Length); newStream.Close(); httpWebRequest.Credentials = CredentialCache.DefaultCredentials; WebResponse response = httpWebRequest.GetResponse(); storeLink.Webid = collectionLink.Id; storeLink.Linkposted = httpWebRequest.GetResponse().ResponseUri.AbsoluteUri; storeLink.DatePosted = DateTime.Now; storeLink.TimesId = timeId; CommonFactory.Insert(storeLink); } { }
Ebooks dành cho dế yêu của bạn: http://sachdidong.com/
Góc nhỏ của tôi: http://seekill.com/
mình biết nếu forum VBB mà dùng encoding là ISO-8859-1 thì kiểu chữ nó sẽ lưu trữ dạng HTML Encode kiểu như chữ ư thì trong database nó là &.#.432; (ko có dấu chấm); . Ko thì view source nó ra là biết. Bạn thử tìm hiểu nó xem
khi request bạn encode nó thành URL encode là đc. thử đi nhéchẳng lẽ thua chỗ này nhỉ
Bạn thử thay ASCIIEncoding bằng UTF8Encoding xem sao?
Anh yêu em hí hí
Mình cũng đang tim hiểu vấn đề này.
bạn cho mình code của bạn với đi
Thằng Thích Thằng Chê Mặc Kệ Người Đời Soi Mói. Tao Thích Tao Làm Tao Làm, Tao Làm Những Gì Tao Thích