Tridion Rich Text Field DWT   output to "?" - tridion

Rich text field value <div> </div>
output <div>?</div>
DWT:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
##Component.Fields.Text##
</html>
what did i miss?
thanks

I can't try it out now due to lack of time, but a few things come to mind:
What's the encoding set on your publication target?
Do you get the same result in Template Builder and Preview?
If you open the published file with a text editor like Notepad++, what does it show?
EDIT
In preview I get this:
<div> </div>
After publishing I get the same as you:
<div>?</div>
So I changed my publication target to use "Unicode (UTF-8)" instead of "System Default", and now when I publish I get this:
<div> </div>
I then referred to Elena's excellent 7 clues to deal with encoding, and figured out I was missing this on my web.config:
<globalization fileEncoding="UTF-8" requestEncoding="UTF-8" responseEncoding="UTF-8"/>
This still didn't do it, it was still loading this weird character in between the tags. This last clue was because the encoding was not being applied to pages with the ".html" extension. Renamed my page template to have a .aspx extension, published, pressed F5 and magic, my div now shows:
<div> </div>
EDIT 2 If you want to use the .html extension, just add this to your page's <head>:
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">

Related

ASP.Net error - type is not compatible with the type of control

I have a web site i created using VS2012 web edition,
Running a VB.net asp web site,
In the VS2012 debug/release mode it compiles and everything works good,
When i upload it to a server (Windows server 2008 R2) I get the following error:
The base class includes the field 'html', but its type (System.Web.UI.HtmlControls.HtmlElement) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlGenericControl).
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Line 4: <html id="html" xmlns="http://www.w3.org/1999/xhtml" dir="ltr" runat="server">
Line 5: <head id="Head1" runat="server">
Line 6: <title></title>
I looked a bit on the web and found this :
VS 2010: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot be converted to 'System.Web.UI.HtmlControls.HtmlTableRow'
Installed it but no help,
The site i created was re-created from another vb.net project so i used a web.config with from the old one, maybe it has something to do with it, i have no "assembly" properties it this XML.
Other pages that are not related to that master page (that html tag is running on a master page...) work's fine.
OK,
So after trying a lot of stuff that didnt work i found a solution, i dont like this solution but it works,
I went to the page.designer.vb file, and then looked for the 'html' and 'Head1' properties that were generated there,
In there i replaced their types to System.Web.UI.HtmlControls.HtmlGenericControl
Afterwards, it worked.
Weird bug, nothing else (including the "hot fixes" that are mentioned in other posts helped.
Hope this would help some one out there .
Somehow the designer file and the markup file get out of sync, even if the types appear to match.
I changed the ID attribute of the problematic control, saved, and rebuilt in the markup file. I then changed it back to the original ID, saved, and rebuilt.
Problem goes away!
Weird issue it is I am not sure if there is a proper solution for this but what worked for me was simply changing the Control ID. and then designer.cs file was changed and all worked good.
I fixed it by Cleaning Solution/project -> Rebuild

How to convert .aspx pages and master pages to html pages?

I am doing one project in asp .net.Its completed,then the same project will be done in html5. How to convert the .aspx pages and master pages to html 5? Is it possible?If any one know please tell me.
You can technically make the page HTML5 by changing the doctype...
<!DOCTYPE html>
<html lang="en">
<head runat="server">
<meta charset="utf-8" />
It is also recommended that you specify a lang attribute on the html tag and include the meta tag to define your character set.
This won't give you instant HTML5 semantics, but this is essentially step one. Using the right elements for the right kinds of content will be down to you, for example deciding when to use header, article, section, footer instead of plain div elements and so on.
You should also be able to select "DOCTYPE:HTML5" from the toolbar in Visual Studio - I don't know what version you are using, but I think in the previous version you could download a HTML5 language extension, I'm pretty sure it is included by default in Visual Studio 2012.
what you can do... if I understand your question correctly is, rightclick and say view page source and copy your html or install google chrome and the on each page you can go rightclick and inspect element. you can copy and paste the html of each page including the masterpage content. Its a sloppy way but will work if you only want the html
One of the way that i think you can do is to use http://modernizr.com/ kind of framework to switch between html5 and normal html easily .

Diazo add unwanted html header into json response

I have a blank Plone 4.1 site with only collective.quickupload installed. The upload portlet worked fine until I install plone.app.theming and apply my theme. The files were still uploaded, but the web client got "Failed" status.
Inspecting the ajax response from server I found that they were wrapped by html header.
The old response (before install diazo & apply my theme) was simply
{"success":true}
The new response (after install diazo and apply my theme) was being wrapped by a html tag:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><body><p>{"success":true}</p></body></html>
I've pasted my rule.xml file here (nothing special, there is only one rule conditioned by css:if-content="#visual-portal-wrapper"): http://pastebin.com/SaK13Fni
What should I do to work around this ?
Thanks
To avoid this behavior you have to add an exception in your rules.xml that specify to not apply your theme to your specific view , like this:
<notheme if-path="myjson_view"/>
edit:
I've tried with one of my diazo themes and a json view and I didn't have your issue. So I think the problem is either in your rules.xml or in your json view. You should try one of these two way:
change your rules.xml this way:
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Prevent theme usage in zmi-->
<rules css:if-content="#visual-portal-wrapper">
<theme href="index.html" />
</rules>
have you already specified the "Content-type" of the output in
your json view? Like this:
self.request.response.setHeader("Content-type","application/json")
return json_data
If not, that's probably the problem.
Watch out for using Chrome inspector... it adds the html head and pre tags around your json when you inspect it...it's not actually there if you look at view:source of the page (old school)...

asp.net text messed issue

First of all take a look at website www.elcieloessalud.com/Tratamientos.aspx
I have built this website for a spanish client of mine, it is built in .net framework 3.5
issue is that i have a cms kind of page that allows me to change text of the pages etc.
when changed, text appears perfect in rich text box but page appears messed up. as you can see in the above page lots of aquí,Salvación ,Dios…†etc.. although it should be something like aquí,Salvación,Dios…”
Any help in this help would be appreciated!
Regards,
Umair
Include this on your html header part
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
If you page is not on utf-8, then I suggest to render it on utf-8, or find your charset for your Language and set it. The charset must be the same as your file to have correct render. In the visual studio you can see your char set of your file on the menu: File | Advanced Save Options... In some friends of me this menu is not exist, you can add it on the Tools | Customize. (for more details for how to add it search on internet - there are a lot of info.)
Also you can try to set on web-config (or set your language)
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
Finally i did it :) with help of #Aristos as well!
we need to include
meta http-equiv="Content-Type" content="text/html; charset=utf-8"
in all the pages including masterpage and change charset of language to whatever yours is
and when creating the streamwriter to write we need to indicate the encoding there as well as below
Dim sw As StreamWriter
sw = New StreamWriter(FileName, False, Encoding.UTF8)
and you are done !! :)
happy coding

Blank ASPX page rendered

My web application has one page default.aspx that renders a blank html.
I have some CSS and Javascript files included into the page, but in the browser if I see view source then it shows only:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>
Sometimes it works...but most of the time it doesn't. Refresh doesn't help either.
Whereas there are plenty of Link references and JavaScript references, none of them are included into the page. I tried to put a debug pointer (and also logging from the page load) but it never gets a hit.
IIS - web dev server does not make any difference. I don't even think its a OS, IIS related issue. because the same code on another project working perfectly on the same machine.
By the way my JavaScript file has some un-usual characters in a string like:
Quote: '»',
DOT_ESCAPE : '_DOT_',
NL_ESCAPE: "↕"
Is it a problem or not? I have no idea even what's going on. Can anybody suggest something?
I have resolved this issue. The problem was the js file has wrong code page.

Resources