I have created the following .cfm file using the CFML editor of CFEclipse in Aptana 3:
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>templates</title>
</head>
<body>
£
</body>
</html>
My Workspace encoding is set to UTF-8, but when I save and view the file in a browser my pound sign has changed to £.
I can resolve the problem by adding
<cfprocessingdirective pageencoding = "utf-8"/>
to the top of my CFM file but for the website I am working on I can't realisticly do that for every page and I've tried adding it to the page header include but that doesn't work.
If I save the file as HTML file or save the file using notepad utf-8 the pound sign is fine, so it seems to be related to the CFML editor of the CFEclipse plugin in Aptana. Has anyone come across this issue before or have any ideas on how to resolve it?
Thanks
EDIT (Added charset headers) :
HTTP/1.1 200 OK
Date: Thu, 06 Oct 2011 13:26:11 GMT
Server: Apache/2.2.17 (Win32) PHP/5.3.4 JRun/4.0
Set-Cookie: CFGLOBALS=urltoken%3DCFID%23%3D12703%26CFTOKEN%23%3D40776140%23lastvisit%3D%7Bts%20%272011%2D10%2D06%2014%3A26%3A11%27%7D%23timecreated%3D%7Bts%20%272011%2D10%2D04%2017%3A05%3A01%27%7D%23hitcount%3D314%23cftoken%3D40776140%23cfid%3D12703%23;expires=Sat, 28-Sep-2041 13:26:11 GMT;path=/
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
GET /enc_test3.cfm HTTP/1.1
Host: www.foo.co.uk
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
You have no choice. If you have UTF-8 (or, basically, any "non-ASCII" ~) content in your CFM files, you need to tell the CF compiler how the file is encoded (with CFPROCESSINGDIRECTIVE, as you have done).
As this needs to be done at compile time, it cannot work by putting a tag in your Application.cfc or any "upstream" CFM file, because the "unstreamedness" is determined at runtime, not compile time.
On the whole, it should be a rarety that you have non-ASCII text in a CFM file because a CFM should be pretty much code, not content or data. That said, I realise this is not always possible.
My Workspace encoding is set to UTF-8, but when I save and view the file in a browser my pound sign has changed to £.
Obviously, your crated .cfm files are not really UTF8. CFEclipse does not handle file encoding, at least I haven't seen such settings for it. But Eclipse has ability to define encoding per resourse (File/Properties), is there such thing in Aptana (haven't used it for a while)?
Try putting
<cfprocessingdirective pageencoding="utf-8" />
near the top of your Application.cfc
Related
Hi I am using the chrome Version 49.0.2623.87 (64-bit) in Mac.
When I try to load the ck editor in chrome I am getting the following error:
Refused to execute script from 'ckeditor/ckeditor.js' because its MIME type ('') is not executable, and strict MIME type checking is enabled.
It is working fine in firefox and Safari.
The other answer works however it must be put in the file as
key=value
key=value
ex:
XML=text/xml
js=text/javascript
More info for configuration: https://www.techpaste.com/2014/06/steps-configure-mime-types-weblogic-11g/
This is the problem with web logic server. Server not setting any mime type in the response when browser request the creditor.js .To resolve this issue create a file with name mimemappings.properties in config directory of your server.
Place the following content in the file
XML = text/xml
js = text/javascript
I used Selenium in the Python version.
But I am stuck at the final step. I can open the browser, login, and open the download link but the file does not download automatically.
I have read the documentation, and technically I just need to set fp.set_preference("browser.helperApps.neverAsk.saveToDisk","...") with the right values, but still, it is not working.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import os
fp = webdriver.FirefoxProfile()
fp.set_preference("browser.download.folderList",2)
fp.set_preference("browser.download.manager.showWhenStarting",False)
fp.set_preference("browser.download.dir", os.getcwd())
fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/EDI-X12, application/EDIFACT, application/javascript, application/octet-stream, application/ogg, application/pdf, application/xhtml+xml, application/x-shockwave-flash, application/json, application/xml, application/zip, audio/mpeg, audio/x-ms-wma, audio/vnd.rn-realaudio, audio/x-wav, image/gif, image/jpeg, image/png, image/tiff, image/vnd.microsoft.icon, image/vnd.djvu, image/svg+xml, multipart/mixed, multipart/alternative, multipart/related, text/css, text/csv, text/html, text/javascript(obsolete), text/plain, text/xml, video/mpeg, video/mp4, video/quicktime, video/x-ms-wmv, video/x-msvideo, video/x-flv, video/webm, application/vnd.oasis.opendocument.text, application/vnd.oasis.opendocument.spreadsheet, application/vnd.oasis.opendocument.presentation, application/vnd.oasis.opendocument.graphics, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.mozilla.xul+xml")
browser = webdriver.Firefox(firefox_profile=fp)
browser.get('https://www4.webcas.net/mail02/menu')
browser.find_element_by_xpath("//input[#type='text']").send_keys('login')
browser.find_element_by_xpath("//input[#type='password']").send_keys('pass' + Keys.RETURN)
time.sleep(2) # delays for 2 seconds
browser.get('https://www4.webcas.net/mail02/fm/onetime-ticket?to=enquete')
time.sleep(2) # delays for 2 seconds
browser.get('https://www4.webcas.net/form02/operator/formulator/download?enquete_id=4770')
time.sleep(2) # delays for 2 seconds
In the end, I always have the firefox popup "would you like to open or save".
Is there anything I am doing wrong ?
I found the solution.
The method is the correct one, but the parameters are not correct.
I had to check the file
C:\Users\User\AppData\Roaming\Mozilla\Firefox\Profiles\tofzlgfm.default\mimeTypes.rdf
Where I found the following lines
<RDF:Description RDF:about="urn:mimetype:text/*"
NC:value="text/*"
NC:editable="true"
NC:fileExtensions="zip"
NC:description="WinZip File">
<NC:handlerProp RDF:resource="urn:mimetype:handler:text/*"/>
</RDF:Description>
So, I just modified my line adding text/* to the other values
I hope this will be useful to someone.
I was having the same problem with pdf files, to workaround that I also added the following to the profile
fp.set_preference("browser.helperApps.neverAsk.openFile", "application/pdf")
fp.set_preference("pdfjs.disabled", True)
So in your case you should change the file types to match the ones you want and could ignore the second line. Hope this helps, cheers.
Bonus point: To increase performance, disable image loading with
fp.set_preference("permissions.default.image", 2)
After upgrading to tomcat7 I have run into a problem.
There is a client program reading the response from a jsp and it is failing because it does not expect the Content-Type header to include charset. For some reason tomcat automatically adds the default charset to Content-Type and I cannot find a way to suppress this behaviour.
<%#page contentType="application/json" %>
<%
response.getWriter().print("{\"key\": \"value\"}");
%>
The response looks like this:
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< Set-Cookie: JSESSIONID=3E964B5EA6E85CA4DDFB0DDF653B0297; Path=/test/; Secure; HttpOnly
< Content-Type: application/json;charset=ISO-8859-1
< Content-Length: 25
< Vary: Accept-Encoding
< Date: Wed, 13 Nov 2013 14:24:42 GMT
<
{"key": "value"}
At first I thought it was AddDefaultCharsetFilter adding it, but it specifically only operates on text/*.
(I do agree that the client should be able to handle this situation, but older versions do not, and unfortunately it is not possible to upgrade all clients)
Is there a way to have tomcat just deliver the Content-Type without adding charset?
Thank you!
Look at http://tomcat.apache.org/tomcat-7.0-doc/config/systemprops.html
org.apache.catalina.connector.Response.ENFORCE_ENCODING_IN_GET_WRITER
If this is true then a call to Response.getWriter() if no character
encoding has been specified will result in subsequent calls to
Response.getCharacterEncoding() returning ISO-8859-1 and the
Content-Type response header will include a charset=ISO-8859-1
component. (SRV.15.2.22.1)
If not specified, the default specification compliant value of true
will be used
First, I did a hell of a lot of googling to even get things working on Heroku, but it seems that regardless of whether I let heroku pre-compile my assets during slug compilation, or if I precompile them myself and submit them, either way, my Rails 4 app's application.css is always empty:
$ curl -i http://www.boxscoregeeks.com/assets/application-c712146df692b0fca6c21c0bf1dddcd5.css
HTTP/1.1 200 OK
Content-Type: text/css
Date: Sun, 01 Sep 2013 00:50:10 GMT
Last-Modified: Sun, 01 Sep 2013 00:46:54 GMT
Status: 200 OK
X-Sendfile: /app/public/assets/application-c712146df692b0fca6c21c0bf1dddcd5.css
Content-Length: 0
Connection: keep-alive
To verify, it's fine locally:
$ curl -I http://localhost:3001/assets/application-c712146df692b0fca6c21c0bf1dddcd5.css
HTTP/1.1 200 OK
Last-Modified: Sat, 31 Aug 2013 03:46:55 GMT
Content-Type: text/css
Content-Length: 106237
Connection: keep-alive
Server: thin 1.5.1 codename Straight Razor
My checklist:
I have config.serve_static_assets = true in my production.rb file.
I have gem 'rails_12factor', group: :production in my Gemfile
I did this: heroku labs:enable user-env-compile --app=YOUR_APP. Before I ran that, assets:precompile would not run, despite steps 1 and 2. It would always try to initialize the production database.
Almost all of my googling tells me to do these things above, but here I am still with an empty applicaiton.css file. Any help would be great.
Thanks!
I found my own answer to this question.
The app in question is one that I upgraded from rails 3. So I built and deployed an empty new rails 4 app (and this worked). By diffing the production.rb files, I noticed that the non-working app had a line like this in it:
# Specifies the header that your server uses for sending files
# (comment out if your front-end server doesn't support this)
config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx
This config line is commented out in the new rails 4 app. And the Heroku docs recommend this:
config.action_dispatch.x_sendfile_header = nil # For Heroku
When I changed this, everything worked as expected. This did not seem to matter when the app was running on Cedar in rails 3.
I have a problem of that it seems that the cache.manifest file gets cached itself. Meaning every changes to the file are not being noted by (Mobile) Safari, so it will never update and always show the last cached files.
I tried to avoid it using an .htaccess file in the same directory as the cache.manifest file:
ExpiresActive On
ExpiresDefault "access"
That didn't help so I changed cache.manifest in a php file that contains the following headers:
header("Expires: Mon, 26 Jul 1990 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header('Content-Type: text/cache-manifest');
Anyone have other ideas of how I can make sure the cache file itself will get retrieved if possible?
Works on: Safari (Desktop), Chrome (Samsung Galaxy Tab v10.1), Firefox
Fails on: Chrome, Safari (iOS)
Renamed the cache.manifest.php back to cache.manifest and added the following lines to the .htaccess
<IfModule mod_expires.c>
Header set Cache-Control "public"
ExpiresActive on
# cache.manifest needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
ExpiresByType text/cache-manifest "access plus 0 seconds"
</IfModule>
If I change the revision comment within the cache.manifest and refresh it on Safari (iOS) it still shows me the old file. I am clueless.
According to the HTML5 documentation, if an application cache manifest file is byte-for-byte the same as a previous one, regardless of HTTP cache headers for expiry/etc, it is considered to not require an update.
At the bottom of your cache manifest file, you need to include a comment at the bottom of the file with the timestamp of the most recently modified file, e.g.:
# last modified: Thu, 30 Jun 2011 01:19:46 GMT
This will break up the byte-for-byte identicalness, even if the list of files remains the same but a few are updated.
As alluded to in other answers, cache manifests are a real pain to deal with.
I've tweaked a PHP manifest "build" script for my HTML5 notepad app.
Tested and working on Chrome, Firefox, IE8+, Android and iOS.
It's open source and available here: https://github.com/JasonHanley/note5/blob/master/build.php
I also use the ExpiresByType text/cache-manifest "access plus 0 seconds" in my .htaccess and I believe that is necessary in addition to generated manifest timestamps.
I've just stumbled onto this one myself, and in a similar vein to SimpleCoders suggestion I'd suggest that if you are using Apache you can generate the cache.manifest using Server Side Includes, eg:
CACHE MANIFEST
# <!--#flastmod file="index.html"-->
# <!--#flastmod file="whatever.js"-->
# <!--#flastmod file="whatever.css"-->
whatever.js
whatever.css
That way, whenever any of those files are updated, the manifest will change automatically. You may also need to enable includes for that file and disable caching, eg: Apache config something like:
Alias /whatever /var/www/whatever
<Directory /var/www/whatever>
Options +Includes
AddHandler server-parsed .manifest
</Directory>
CacheDisable /whatever/ihealth.manifest
Check your server logs to make sure you're returning the file with a "200 Okay" rather than a "304 Not Modified".
The cache manifest is a terrible piece of technology.
The browser is not caching the manifest; instead, it's just failing to recognize that it has changed which is what you are observing. Try adding a random comment or two to your manifest (prepend comments with #) and then see if it works.
Just modifying files that the manifest references won't trigger the browser to redownload the manifest. If this is what you were hoping for, then try this: Use a PHP file to generate your manifest. Of course, use header to set the proper MIME type. After you have echoed out all of your resources, echo out the hash of the timestamp of all of those resources. That way, if one of them is modified, the manifest file changes. This is what I'm using:
// Collect a list of resources we need to check (customize to your needs)
$files = array(
"/scripts/script1.js",
"/scripts/script2.js",
"/scripts/script3.js",
"/scripts/script4.js",
"/css/style.css"
);
$filetime = 0;
foreach ($files as $file) {
$filetime += filemtime($file);
}
// This echoes out the hash of the filetimes as a comment
echo "#" . sha1($filetime);