Slim3 + Twig Arabic text =? - twig

I'm using Slim 3 framework, and Twig view to render the views.
In my view, I have some Arabic text here and there, but when running the application, it shows question marks for the Arabic characters.
the page has a
<meta charset="utf-8">
in the header, but doesn't seem to make any difference.
Here's the line with the Arabic Characters:
<a class="navbar-brand" href="http://mbc-group.com">مجموعة ام بي سي</a>
Anyone knows if this is related to slim or twig?
Anyone can help on this?
Thanks in advance.

Related

Braintree dropin ui showing junk characters insted of bullet mark in card number

Well, I am not able to find the answer anywhere for this.
So i am creating a client token with customer id to show already used payment methods in dropin ui. But instead of showing the card numbers like this
its showing me like this.
Anyone facing this issue? Any solution?
It looks like your Drop-in UI is trying to render the dots in the credit card number placeholder, but the page isn't accepting UTF-8 characters. This problem should be resolved if you add <meta charset="utf-8"> in your <head> tag.
Alternatively, you can include the UTF-8 charset in your Drop-in UI script tag. As an example, it would look something like this:
<script charset="UTF-8" src="https://js.braintreegateway.com/web/dropin/1.12.0/js/dropin.min.js"></script>

Sublime Text adding additional opening tag at the beginning?

So every time I use html snippet or boiler plate with <ht + tab or enter
I get this extra opening tag? What gives?
<<!doctype html> <---- whats that additional tag at the beginning?
<html>
......
....
I got emmet installed by the way. Thanks
It's a snippet. You type html (or less), and press tab, it'll inserts all this content:
<!DOCTYPE html>
<html>
<head>
<title>$1</title>
</head>
<body>
$0
</body>
</html>
Note that if you repress tab again, it'll go to $1, and the last one is $0 (by default it's the end of the content).
So, don't type <ht, just ht, tab, and it'll insert everything for you. I really recommend you find yourself a course about Sublime Text, you're going to miss so much otherwise
That is the doctype decleration this is straight out of hte W3School docs:
The declaration must be the very first thing in your HTML
document, before the tag.
The declaration is not an HTML tag; it is an instruction to
the web browser about what version of HTML the page is written in.
In HTML 4.01, the declaration refers to a DTD, because HTML
4.01 was based on SGML. The DTD specifies the rules for the markup language, so that the browsers render the content correctly.
HTML5 is not based on SGML, and therefore does not require a reference
to a DTD.
Tip: Always add the declaration to your HTML documents, so
that the browser knows what type of document to expect.
You can read more about it here: http://www.w3schools.com/tags/tag_doctype.asp

HTML Agility pack + Select node by its inner text

I have gotten the hang of using the html agility pack to find specific nodes using their attributes and xpaths. The problem is, I've been doing this manually for each of my projects (opening the website html and scanning for the nodes that have the text i need). Is there a way to select a single node by its inner text? This would make it easier to write an update script for websites whose content scheme is the same, but attribute tags change values over time. Thanks in advance!
Would be better if you have provided sample HTML, but since you haven't, let's assume we have HTML containing this markup :
<body>
<div class="foo">bar</div>
</body>
You can select the <div> by it's attribute using HtmlAgilityPack's SelectSingleNode() and XPath like so :
myHtmlDocument.DocumentNode.SelectSingleNode("//div[#class='foo']");
or you can select the same by the inner text like so :
myHtmlDocument.DocumentNode.SelectSingleNode("//div[.='bar']");
Hope this help.

JSP out.println not rendering html tags

In a text area in jsp i am trying to dipslay some text in bold but it is not rendering the tags and displaying as it is:
e.g.
<% out.println("<b>"+Pattern+"</b>");%>
where String Pattern =ERROR
this shows as
<b>ERROR</b> .....in the veiw source it shows like <b>ERROR</b>
Is it not supposed to work this way ? what are other ways to make it bold.
Change it to:
<%= Pattern %>
its like printing it direct into the html Page
Just try <b><% out.println("+Pattern+");%></b>.

Meta keywords before doctype declaration?

I recently was browsing a local web design firm's portfolio and found all their sites' code begins as such:
<meta name="keywords" content="a whole bunch of keywords for their site">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
...
I was able to determine that the pages were generated by dreamweaver (at least in part).
Did dreamweaver do this, or did their "developer" just paste the code at the top of the document.
It is my impulse that this is bad practice and it might work incorrectly on some platforms but it got me wondering as to whether or not their may be a reason for this?
That is a terrible practice and invalid HTML. I bet that this would throw IE directly into quirks mode.
But as for your question, either the developer is a script kiddie and shoved the <meta> tag in there with little knowledge of the outcomes, or Dreamweaver did it. I hope it was Dreamweaver...
FYI - just had this issue and Dreamweaver does not put the meta tags in the correct position automatically. Cursor must be placed beforehand into an editable region.

Resources