You may encounter the following error when using afnetworking: {status code:200, headers { "Content-length" =;"Content-type" = "text/plain;charset=utf-8";Date = "Thu, 10:37:50 GMT";Server = "apache-coyote/1.1";"Set-cookie" = "JSESSIONID=C0DFED60A154557F8386E62AB2A066CE; Path=/fhjrdt ";}}, Nslocalizeddescription=request failed:unacceptable Content-type:text/plain
We can use many methods to convert html to plain text. However, the simplest method is to use the strip_tags function. However, some friends may find that they can filter out html by using a user-defined function. The following describes some methods.
= Velocityengineutils.mergetemplateintostring (Velocityengine, "INDEX.VM", model);
Declare the Map object and fill in the key values used to populate the template file with the mapThis allows us to populate the variable values in the VM and convert the content to string5.4 Set message content, same as 4Java code
Helper.settext (Emailtext, true);
Helper.settext (Emailtext, true);Other content is the same as the above 1, 2, 3 proc
jquery intercepts strings, date strings to date, and gets plain text in Html.varcom = com | | {};(function($, Com) {/** Intercept String * @param str: string to intercept * @param len: how many characters are reserved * @param symbol: The character to be added after the end of the string*/Com.cutstr=function(str, len, Symbol) {if(symbol = =Undefined) {symbol= "..."; } Len= Len | | 25; varresult =str; if(str
This example describes the C # implementation of the method of converting HTML to plain text. Share to everyone for your reference. Specific as follows:
How to use:
Htmltotext convert = new Htmltotext (); TextBox2.Text = Convert.
part
Msg.settext (body);
msg.setcontent (Body, "text/html;charset = GBK");
//Save changes to the MimeMessage instance
Msg.savechanges ();
//write the contents of the Msg object to the file
Msg.writeto (new FileOutputStream ("htmlmail.eml"));
}
}
Note the msg.setcontent (body, "text/html;charse
Delete html tags to obtain labels that can be embedded in plain text. The method is basically from the source code in THinkphp, but I modified it and copied the code as follows :? Php ** @ Description: deletes HTML tags to obtain plain t
wrong, for example, less than the symbol, the use of the strip_tags function will return the error, and Htmlspecialchars will not have errors appear, is still converted to an HTML entity.Difference Three:It is generally recommended to use the htmlspecialchars function when preventing XSS attacks, because strip_tags can delete HTML tags, but it does not remove "或‘。因此就算你使用了 strip_tags, You still need to use
In the previous article, the www. oschina. netcodesnippet_1182150_25127 attachment function was not written, but it was reserved. PHP source code and demo: source code? Php *** mail sending class ** supports Sending plain text mails and HTML-format mails, which can be multi-recipient, multi-CC, and multi-secret CC * @ example * $ mailnewMy
Previous upgrade: http:
The method basically comes from the source code in the thinkphp, but I changed it a bit.
Copy CodeThe code is as follows:
/*
* @Description: Delete HTML tags and get plain text. can handle nested labels
*
*/
Class deletehtmltags{
Private $filename;
function __construct ($filename = ' c:/appserv/www/text.txt ') {
$this->filename = $filename;
}
/**
* Delete
Php removes html tags to obtain the input plain text document strip_tags
$ Text ='Test paragraph.
Other text ';
Echo strip_tags ($ text );
Echo "\ n ";
// Allow
Ech
This article mainly introduces how to delete html tags to process nested tags in plain text. For more information, see the following method: the source code in THinkphp, but I modified it.
The code is as follows:
/** @ Description: delete HTML tags to obtain plain
The method basically comes from the source code in the thinkphp, but has been modified by me
Copy Code code as follows:
/*
* @Description: Delete HTML tags and get plain text. can handle nested labels
*
*/
Class deletehtmltags{
Private $filename;
function __construct ($filename = ' c:/appserv/www/text.txt ') {
$this->filename = $filename;
This article mainly introduces the HTML and CSS implementation of plain text and buttons with icons, buttons have a lot of appearance, this article introduces the text and the two buttons with icons, interested in small partners can refer to
This article summarizes some of the basic elements of the implementation of t
The method is basically from the source code in THinkphp, But I modified it.Copy codeThe Code is as follows:/** @ Description: delete HTML tags to obtain plain text. Can process nested labels**/Class deleteHtmlTags {Private $ filename;Function _ construct ($ filename = 'C:/AppServ/www/text.txt '){$ This-> filename = $ filename;}/*** Delete
iOS uses regular expressions to remove tag elements from HTML for plain textcontent是根据网址获得的网页源码字符串 NSRegularExpression *regularExpretion=[NSRegularExpression regularExpressionWithPattern:@" options:0 error:nil];content=[regularExpretion stringByReplacingMatchesInString:content options:NSMatchingReportProgress range:NSMakeRange(0, content.length) withTemplate:@"-"];//替换所有
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.