Formatting Text in Resource file - asp.net

I have a site that sends a variety of different emails. these are stored in a resx file. (The emails are sent as text not html, or else I suspect that what I am asking would be a lot easier)
I have now been asked to make some of the text in one of the emails bold. so that, for example I can have
We can accept your decision now... instead of We can accept your decision now...
I have tried creating my formatted text in word, and then cutting / pasting it into the resource file, but that strips out all the encoding.
Is there any way of storing formatting within the file, or do I need to rethink my approach? (In which case, I guess I either split the email into fragments, and when I am assembling the final string, I apply a font style to the relevent fragments, or I store my formatted emails in files and folders, and load them as required.)

You should insert HTML in your text , "<b> We can ac...</b>" will result in bold text in the receivers end.

If you don't want to use a HTML format, you should create your email in a RTF format. It is not possible to bold your text if you are sending just a plain email. How to send it depends on the library you use for sending emails.
I've sent a RTF formatted email (with normal and bold text) from MS Outlook 2013, and the source code looks like that (similar like in HTML):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-2">
<META NAME="Generator" CONTENT="MS Exchange Server version rmj.rmm.rup.rpr">
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P DIR=LTR><SPAN LANG="pl"></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">We can accept your decision now...</FONT></SPAN><SPAN LANG="pl"></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="pl"><B></B></SPAN><B><SPAN LANG="en-us"><FONT FACE="Calibri">We can accept your decision now...</FONT></SPAN></B><SPAN LANG="pl"><B></B></SPAN><B><SPAN LANG="en-us"></SPAN></B></P>
</BODY>
</HTML>

Related

google plus doesn't show meta information snippet from xhtml documents

I have been fighting with this for some time now, but I cannot figure out even a why it doesn't work. Take this simple XHTML test source:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>foobar</title>
<meta name="description" content="baz" />
</head>
<body vocab="http://schema.org/" typeof="Article">
<h1 property="headline">Some title</h1>
<p property="description">some arbitrary text</p>
<p>and even more of it</p>
</body>
</html>
(for testing with google plus, this is also temporarily available here, and here you can find the plain html version)
If you paste a link to the XHTML version to g+, you'll find that it's unable to parse it at all. It will just show the link. The HTML version however seems to be parsed. Both parse well in the rich snippet tester from google. Even more, we have evidence indicating that our XHTML websites rich snippets are used in googles search.
The content type is announced correctly as application/xhtml+xml for the xhtml version, and I cannot figure out any other problem. I already tried to leave out the xml-declaration and use a XHTML 1.1 strict doctype, without any success.
So my question(s):
Why doesn't g+ show a snippet at all for this file in XHTML version, even though facebook does?
Can this be corrected somehow, without dropping XHTML, and if so, how?
I guess the parser g+ uses might not support XHTML, and possibly bails out if it can't handle the application/xhtml+xml MIME media type. Last time I heard the g+ and Google Rich Snippet testing tool were not using the same toolchain, so it's quite likely that something that works in the Rich Snippet testing tool might not work elsewhere, though it's a good sign if it works in the testing tool. I would think that in the future Google would align all their products with the capabilities of the rich snippet testing tool.
Do you have any specific reason for using XHTML as opposed to HTML or HTML5 served as text/html?
The microdata from your example doesn't appear to be in the expected format. You can generate the necessary microdata at: https://developers.google.com/+/plugins/snippet/
Notice the missing itemprop, itemscope and similar attributes:
<body itemscope itemtype="http://schema.org/Product">
<h1 itemprop="name">Shiny Trinket</h1>
<img itemprop="image" src="{image-url}" />
<p itemprop="description">Shiny trinkets are shiny.</p>
</body>

Meta tag not in first 1024 bytes

Caveat: Before someone goes and marks this as duplicate of this, please understand that it is not. The accepted answer is exactly what I am doing, yet I am facing the following issue.
HTML file in client folder looks like this:
<head>
<meta charset="utf-8"/>
<title>blah-blah</title>
---
The message I am getting in the firebug console is:
The character encoding declaration of the HTML document
was not found when prescanning the first 1024 bytes of
the file. When viewed in a differently-configured browser,
this page will reload automatically. The encoding
declaration needs to be moved to be within the first
1024 bytes of the file.
When I do a view source, between the head and the meta charset element, I see a whole bunch of link stylesheet and script tags.
If I remove the meta charset, I get this in the firebug console:
The character encoding of the HTML document was not
declared. The document will render with garbled text
in some browser configurations if the document
contains characters from outside the US-ASCII range.
The character encoding of the page must to be declared
in the document or in the transfer protocol.
How do I get the meta charset tag to appear right after the head?
What I did was edit /usr/lib/meteor/app/lib/app.html.in, and add the meta charset line so that the file now looks like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/> //**Added this line**
{{#each stylesheets}} <link rel="stylesheet" href="{{this}}">
{{/each}}
...
And of course I removed the meta charset line from my html files.
I think right now, this would be the way to go and this will be resolved in future revisions.
I had the problem in IE to force to use the latest version.
I had to add
<meta http-equiv="x-ua-compatible" content="IE=edge">
Directly behind the tag. And app.html.in seems not to be used anymore.
So I did this on tools/latest/tools/bundler.js
Line 783
'<head><meta http-equiv="x-ua-compatible" content="IE=edge">\n');
That forced it to add it in the html boilerplate.

ASP.NET 404 Response Text Chinese-like

When loading a page containing references to non-existing URL's using tags, I see a strange text reply from the server.
The server does return status code 404 as expected, but it also includes a text response with chinese-like characters.
Is the server infected, or is the error message just in a different language than english ... ?
If infected, how can I find out where?
Here is an example of the text replies. It seems that the reply is identical for each 404 error, although a part of it changes when a different filetype is not found.
㰡䑏䍔奐䔠桴浬⁐啂䱉䌠∭⼯圳䌯⽄呄⁘䡔䵌‱⸰⁓瑲楣琯⽅丢•桴瑰㨯⽷睷⹷㌮潲术呒⽸桴浬ㄯ䑔䐯硨瑭氱⵳瑲楣琮摴搢㸍਼桴浬⁸浬湳㴢桴瑰㨯⽷睷⹷㌮潲术ㄹ㤹⽸桴浬∾ഊ㱨敡搾ഊ㱭整愠桴瑰ⵥ煵楶㴢䍯湴敮琭呹灥∠捯湴敮琽≴數琯桴浬㬠捨慲獥琽楳漭㠸㔹ⴱ∯㸍਼瑩瑬放㐰㐠ⴠ䙩汥爠摩牥捴潲礠湯琠景畮搮㰯瑩瑬放ഊ㱳瑹汥⁴祰攽≴數琯捳猢㸍਼ℭⴍ੢潤祻浡牧楮㨰㭦潮琭獩穥㨮㝥活景湴ⵦ慭楬示噥牤慮愬⁁物慬Ⱐ䡥汶整楣愬⁳慮猭獥物昻...
You have a character encoding issue. It is a ASCII file that is being interpretted as a 2byte character encoding and thus you are getting the strange characters.
To translate it I copied the text to notepad. Saved it as Unicode-Big Endian and then used a hex editor to strip the first two characters (that tell it that it is unicode). Opening it again gave me:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>404 - File or directory not found.</title> <style type="text/css"> <!-- body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;
You would need to look into things to see if it is declaring the wrong content type in an HTML header (the content type in the meta tag looks correct) or something else is causing it problems.

Influencing the encoding for pages served by meteor?

How can I set a encoding for my pages served with meteor? Currently my Firefox keeps on outputting this warning:
The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol.
Just set your encoding inside any <head> section of a html file:
<head>
<meta charset="UTF-8">
<title>Whatever</title>
</head>
From Meteor's documentation:
HTML files in a Meteor application are treated quite a bit differently
from a server-side framework. Meteor scans all the HTML files in your
directory for three top-level elements: <head>, <body>, and
<template>. The head and body sections are separately concatenated
into a single head and body, which are transmitted to the client on
initial page load.

does TinyMCE supports other languages to compose HTML emails?

I have used Tiny mce once in a asp.net project and found it a very nice tool.
Here is requirement of composing HTML emails in languages other then English (Spanish, French, German and Arabic) in asp.net project.
Kindly guide me does tiny mce support languages other then English ? Is it something tiny mce should be supporting or something will be required on client side to be installed ?
Thanks for your time and sharing.
You need to add on the html generated part from this editor, a header that says the language that the text are, just like you do on html pages. Then you add this html text to your html part of your email and send it.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=LanguageEncodingCode" />
<body>
.............. paste here what you get from this html editors.............
</body>
</html>

Resources