encoding problems on site.master page (asp.net mvc2) on production server (2003 with IIS 6) - asp.net-mvc-2

I have a site that uses the Hebrew language.
All the pages looks great, expect from the text that is generated in site.master.
This text comes a gibberish.
This is from master page:
<ul id="menu">
<li>
<%: Html.ActionLink("לקוחות", "List", "Customers")%></li>
same code from any other page shows hebrew chars.
The result is either gibberish, or encoded gibberish:
<div id="title">
<h1>
îòøëú ðéäåì ùéáåõ èëðàéí</h1>
</div>
<div id="menucontainer">
<ul id="menu">
<li>
ì÷åçåú</li>
tried to switch encoding in the browser but nothing gets me back to Hebrew.
This happens ONLY on production server, on my Dev machine (win7) it works fine.
The views inside the master pages shows OK also on production.
Any ideas ?

My advice would be: ditch the IIS 6 and use IIS Express, which you can install on most old OS's. It does introduce another technology into the question but this technology is newer, easy to use, maintain and script and more suitable for this new range of web development technologies like MVC, etc.
So, if you have an option to select what you use and can make decisions about it, definitely go for it.
Alternatively, you can play around with server regional settings and stuff like that but you might end up losing lots of hours to this.

Related

Wagtail. Ability to edit html within editor

My editors want to have an ability to edit raw html within editor.
For example, we can have simple list markup:
<ul>
<li>Some text<li>
</ul>
Or with custom classes and event tags:
<ul>
<li class="my_class">Some text
<span class="special">Some additional info</span>
<li>
</ul>
And so on.
I know that built-in Draftail doesnt support html editing.
But using third-party editor comes with problem:
Losing integration with system. For example, i cant just put image like with draftail. Or, preview mode cant handle all functionality of third-party editor.
So, maybe someone has working solution for this situation.
I thought about using special StreamField panels, but it seems to be overhead of blocks. Dont like this idea of having lots of blocks with little differences
Wagtail does not support raw HTML editing within the page editor out of the box intentionally. The philosophy (zen) of Wagtail is to help editors and developers 'wear the right hat' when working in Wagtail.
HTML editing is usually best provided to developers, where there is an expected knowledge of what is required for things like accessibility, security and the benefit of tooling (like git).
However, if HTML editing is a must, you will probably need to build your own editor field for that purpose or find a suitable package that works with HTML markup such as django-markupfield. Adding image/snippet/page chooser functionality however will have to be built for whatever you end up using. You may also want to look at the Wagtail markdown package either as an alternative to HTML or a starting point, it allows for a syntax of linking to pages/images.
Wagtail lets you use any kind of Django field or widget with the FieldPanel.
Please ensure you consider all the risks when implementing this feature, such as accessible HTML (e.g. heading levels), security (disallow some tags such as script tags), malformed HTML leaking into the rendered template and of course the end user experience.
At the end i made my own solution
Simple rewrite some methods in wagtail`s Html DbWhiteLister and HtmlConverter.
This gives me an opportunity to allow any tags with any attributes.
https://github.com/Chenger1/wagtailtinymce.-Full-Rich-Text-Editor

How to easily set the app main page in Intel XDK?

The App Designer in Intel XDK allows us to easily add and remove pages to our apps. In this case, I use the Intel's App Framework. I haven't tried another frameworks.
The page hierarchy is something like this:
index.html
--- page #p-1
------ sub-page #sp-1-1
------ sub-page #sp-1-2
--- page #p-2
------ sub-page #sp-2-1
While adding and removing pages is easy, it is quite difficult to set the "main page", i.e. first page to be displayed when app starts. If I don't want to delete some of my pages using App Designer, then the only thing I can do is to edit the HTML.
This is the typical form of nested tags:
<div id="p-1" class="upage">
<div id="sp-1-1" class="upage-content hidden"></div>
<div id="sp-1-2" class="upage-content"></div>
</div>
By placing hidden next to upage-content, the sub-page will be inactive. So we don't have to reorder the lines of codes.
But the rule for upage is different. We have to reorder the lines of codes. For example:
<div id="p-2" class="upage">
</div>
<div id="p-1" class="upage">
</div>
This is surely inconvenient if we have many lines. With the editor, perhaps we can collapse the nested tags before moving our codes to avoid mistakes.
Is it really the best way to set the app main page or I just don't know that there are options somewhere in Intel XDK?
The editor is somewhat limited, and is constantly evolving. To my knowledge, this is the only way to set the App's main page. If you find this process clunky, it may be in your best interest to propose an enhancement or a new feature on their product's forums. (They have a pretty active community)
Their support forum is here: https://software.intel.com/en-us/forums/intel-xdk

Integrate Htmls into GWT

We have a web application that its UI is based on GWT.
We are pretty satisfied from the technology, but we have one major problem: We get html files from our designer, and it takes a lot of time to integrate them into our GWT code.
Is there a quick way or rules to do that?
For instance, I would like to take the html, put it almost "as is" in a ui.xml file, and then start binding the components to UiBinder fields.
What is the quickest way to do that? What should I do with the CSS and JS files that I get?
I need some guidelines to make this conversion, so it will be quick & easy.
We have the same problem. It might be hard for a designer to get used to GWT widgets. But he'll have to forget about making HTML proof-of-concepts and using GWT directly.
We didn't overcame the difficulty. As a result, many GWT features are under-used (like CSSResources, or GWT-Bootstrap layout capabilities).
I would advise to have him learn the xml of GWT widget libraries.
You can also start by using GWT Designer. This way he can still do the design, learn the XML bit by bit, and you can still work on wiring the components.
Of course it is a slow process. People don't change old habits instantly.
Errai seems to fit your requirements.
Basically is uses regular HTML5 templates, binded to GWT logic.
"Create standard conform HTML5 templates or use existing HTML and CSS files to design your web and mobile applications."
http://errai.github.io/
Here is an example of a sign-in page:
<!DOCTYPE html>
<link rel=stylesheet href="css/TodoList.css">
<div data-field="main">
<h1>Get it done with Errai.</h1>
<div class=form>
<p class=error data-field=loginError>
Login failed. Please check that your email address and password were entered correctly.
</p>
<input type=text data-field=username placeholder="Email">
<input type=password data-field=password placeholder="Password">
<button data-field=loginButton>Sign In</button>
<p>New here? Sign up in seconds!</p>
</div>
</div>
source
(p.s. I've never used it, yet)

Question marks where should be an X

I'm using Zend Framework and Twitter Bootstrap for a website. From twitter bootstrap I'm using things like the alert:
<div class="alert">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Warning!</strong> Best check yo self, you're not looking too good.
</div>
Where an X is supposed to appear, appears a question mark (?). I have my charset as UTF-8.
That is not the only thing that is happening but in many places where I'm supposed to have Spanish characters what appears is a question mark. Does anybody know what's wrong? Thanks!
Dito, you might just put an simple x there instead of the multiply sign. You can also check out if it works with this HTML entity:
×
I've learned that encoding is a very difficult topic. There is the doctype declaration in your document – but there is also the web server (apache?) declaration and even a PHP setting. You can check out your website settings by hitting cmd+I (ctrl+i on a pc/linux) in FireFox.
My Hex editor told me that it is × and not x .
Remove charset from your meta in html and try again. Also, try to replace that with a 'real' x.

htmlencode TinyMce/textarea to sql MVC 2 .net 4

I am creating a simple ‘site news’ feature on an MVC 2 .net 4 web site. The site news articles are kept in a simple sql data base, actually I’m doing it with Entity Framework Code First and compact sql, consisting of colums articleID, articleDate articleSummary and articleDetail (model.ItemEntry in code below). The articleDetail is a textarea that I would like to edit with TinyMce or some other WYSIWYG editors if you have alternate editors to suggest or recommend please do so and why.
I’m looking for a way to have the text in the articleDetail enterd by TinyMce by way of the textarea, which may contain html as well as text, htmlencoded as it’s recorded into rows of the table. Seems to me that would be a likely configuration option, I haven’t found it. And that by htmlencoding the textarea would bypass all the difficulties I’ve encountered while attempting to save the TinyMce/textarea data to sql.
Although I will use this live it’s mainly a learning experience. And I’m a bit stubborn on wanting to learn how to do this. Otherwise I would just use the textarea and skip the WYSIWYG for this simple application.
While attempting to compose simple text using TinyyMce I’ve run into the problem of .net 4 and requestvalidation. It appears that I would have to relax my security by placing <httpRuntime requestValidationMode="2.0" /> in the web config and add [ValidateInput(false)] to my controllers create post action. I don’t want to relax the security that .net 4 is providing, kinda stuck now as to how to strip the html from the TinyMce/textarea.
At this point it occurred to me that what I really wanted to do was htmlencode the text as it could be valuable to have some html formatting in the articleDetail. Blog posts and other applications save information in sql that will somehow eventually be html, how do they do it?
In Summary (some of) my questions are
Are there any WYSIWYG editors that htmlencode their content? That way I could have htmlencoded html news articles stored in sql. I’ll then be attempting to htmldecode that for display when news articles are displayed.
alternately
How might I just simplify strip the html from the TinyMce/textarea before I save to sql?
Is relaxing to requestValidationMode="2.0" my only solution?
Research resources I’ve found helpful in this learning experience.
Ack! couldn't post 'em as this is my first post. Gee I thought I read the FAQ and was being a good Nerditquette kinda guy. Incidently I composed this in Live writer and it's posted here on my blog including the links I had researched and found helpful.
Some relevant pieces of source code.
Create.aspx
<script type="text/javascript">
tinyMCE.init({
mode: "textareas",
theme: "simple"
});
<div class="editor-label">
<%: Html.LabelFor(model => model.ItemEntry) %>
</div>
<div class="editor-field">
<%: Html.TextAreaFor(model => model.ItemEntry) %>
<%: Html.ValidationMessageFor(model => model.ItemEntry) %>
</div>
NewsController.cs
// POST: /News/Create
[HttpPost]
// [ValidateInput(false)]
public ActionResult Create(Item item)
{
if (ModelState.IsValid)
{
siteNews.Items.Add(item);
siteNews.SaveChanges();
return RedirectToAction("Index");
}
return View(item);
}
Why would you want to htmlEncode your content just to save it in the database? It's a useless step.
Why do you want to strip the html if you're using a rich text editor? If just want text, stay with a textarea. You can configure tinyMCE to use bbtags but I would only use that for users who can't be trusted.
Setting your requestValidationMode to 2.0 is how you can allow your code to save html. There is nothing wrong with that.