A Sprockets::EncodingError exception is thrown when I include a file with characters that are valid utf-8.
The line in question is:
* Copyright (c) 2010 - 2011 Johan Säll Larsson
If I replace the ä character, the problem goes away, but I don't want to have to remember to edit this vendor file everytime I update it.
How can I fix this?
I found the solution via the comments on this Sprockets issue:
I simply saved the file as utf-8, (TextMate has an option to do this when you chose 'Save As'), and the problem went away.
The commenter #shedd also created a useful rake task to find assets which are not encoded properly.
This is fixed in trunk. All files use utf-8 without BOM.
Related
I am trying to configure NXlog to work with AlienVault based on the guide here
I installed the custom config file from AlienVault and modified the destination IP only. When I did this I could not get the NXlog service to start - Then I reinstalled the default config but I still cannot get it to open.
I edited the file in notepad which I thing should be safe, however I have read here that it is possibly the UTF-8 BOM - I am not sure how to check if there is one but I do not believe there is because I only used notepad.
The first line in the config file looks like so:
define ROOT C:\Program Files (x86)\nxlog
The NXlog Log file with the errors is only displaying this error:
nxlog failed to start: Invalid keyword: define at C:\Program Files (x86)\nxlog\conf\nxlog.conf:1
Not very helpful - Seems to be choking on the very first word - Anyone seen this before???
I'm pretty sure that's caused by the UTF-8 BOM in your config file. I suggest using and checking with an editor that can handle this. In HEX mode you can confirm whether the file has a BOM or not.
The NXLog EE v4.0 can cope with the BOM properly BTW.
As B0ti mentioned, my problem was caused by the BOM - I couldn't figure out how to fix this on windows so I downloaded the file into a Linux environment and fixed it there. To do so follow these steps -
First I verified there was a BOM in place with the file command:
ex: file filename.txt -This will print information about the file - if there is a BOM you will see that.
Next I followed the answer here for removing the BOM:
Basically just do this in the Linux box - sed '1s/^\xEF\xBB\xBF//' < orig.txt > new.txt
Then I transferred the new file back to the Windows box and all was right with the world!
I have my camel configured to download all files from a specific FTP directory. Now this is all easy enough and everything seems to be working fine. However, I am running into errors when the files contain a space in their names such as File 123.csv. I know I could specifically target the files with an escape character. The only difficulty is that these files are dynamic in nature and change daily, so I will not know which files may or may not have spaces.
I figure I can just read all the file URI and make adjustments from there. But I was wondering if there is any Camel specific way to handle this.
Errors: java.lang.IllegalArgumentException: Illegal character in path at index 60: hdfs://test.net/user/CamelTests/File Layout.csv
GenericFileOnCompletion - Rollback file strategy: org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy#fe8d1b for file: RemoteFile[File Layout.csv]
Camel Code
from("{{ftp.serverLP}}/Memo/Loss?username=ftp&password=pass")
.to("hdfs2://Test.net/user/CamelTests/?fileSystemType=HDFS")
.log("Downloaded file ${file:name} complete.");
Try changing the .to(..) to use a non-HDFS file system.
The error posted seems to indicate a problem with the destination to which the files are being copied (HDFS), not the FTP source.
I ran into a problem deploying on Heroku do to a failure in the rake task
rake assets:precompile
At the bottom is the error I get if I integrate
Rails 3.1
Jquery calendar: https://github.com/themouette/jquery-week-calendar
Twitter bootstrap
The error happens from uglifier.
I suspect that problem could be related to the inclusion of many localizations for the calendar.
I worked around the error by setting:
# Compress JavaScripts and CSS
config.assets.compress = false
I was not able to examine the files as the temporary files are cleaned up. I also could not get the debugger in RubyMine to stop at a breakpoint.
Any ideas if this is a bug? Any way to get the temporary files to not get deleted? Any way to make the RubyMine debugger work on the rake task (yes, tried the obvious, using EAP 112-291.
rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted! Unexpected character '' (line: 21454, col: 0, pos:
641761)
Error
at new JS_Parse_Error (/tmp/execjs20111231-15374-1fve7h4.js:497:22)
at js_error (/tmp/execjs20111231-15374-1fve7h4.js:505:15)
at parse_error (/tmp/execjs20111231-15374-1fve7h4.js:596:17)
at Object.next_token [as input] (/tmp/execjs20111231-15374-1fve7h4.js:839:17)
at next (/tmp/execjs20111231-15374-1fve7h4.js:943:37)
at Object.semicolon [as 1] (/tmp/execjs20111231-15374-1fve7h4.js:986:38)
at prog1 (/tmp/execjs20111231-15374-1fve7h4.js:1527:28)
at simple_statement (/tmp/execjs20111231-15374-1fve7h4.js:1123:35)
at /tmp/execjs20111231-15374-1fve7h4.js:1031:35
at /tmp/execjs20111231-15374-1fve7h4.js:1510:32
You will probably find that one of you js files has a syntax error somewhere. This could be a missing semicolon at the end of a block, or some other minor problem. Often browsers will still load the js and it will work, but uglifier cannot compress it with those errors. I would start looking in the localisation files first.
One way to find out which file contains the error is to re precompile locally with a minimal set of files and add things one by one until it breaks. If it is due to a missing semicolon, the breakage will the second-last file you added.
Mine precompiled after I removed a stray "debugger" statement. Woops.
If anyone reading this thread encounters issues with unicode characters or "invalid byte sequence in UTF-8" in your rails app, try putting this in your production.rb file:
# override default uglifier options so we don't mangle unicode
config.assets.js_compressor = Uglifier.new(output: {ascii_only: true})
In my case, the uglifier was converting strings in my javascript like \udbff into UTF-8 characters í¯¿ which ultimately was breaking some unicode regex. (This was happening with turbo-sprockets and codemirror but you might encounter it anytime your javascript relies on ASCII representations of unicode characters.)
The I18N file "jquery-ui-i18n.js" has a bad character before each comment.
Looking at the first two lines with "more" in a shell, shows the wrong character:
<U+FEFF>/* Afrikaans initialisation for the jQuery UI date picker plugin. */
/* Written by Renier Pretorius. */
After having removed this character it works.
Can phpDocumentor be used to generate HTML docs for some legacy code that does not necessarily conform to its standard?
I'd like to generate some preliminary documentation for an old code tree and later on start improving my comments and add the appropriate # tags as I get fluent with phpDocumentor. I've never used this piece of software before and the examples I've found focus on how to write new code that conforms to its syntax and generate HTML file by file with the -f parameter.
I've installed latest phpDocumentor through the PEAR command line installer and tried this little *.bat file on Windows XP:
#echo off
phpdoc ^
--directory "\\server\project\trunk" ^
--target "C:\tests\project-doc"
... but this is all I get:
PHP Version 5.3.5
phpDocumentor version 1.4.3
Parsing configuration file phpDocumentor.ini...
(found in C:\Archivos de programa\PHP\pear\data/PhpDocumentor/)...
done
Maximum memory usage set at 256M after considering php.ini...
using tokenizer Parser
directory: '' not found
I've also tried mapping the UNC path to a drive letter:
#echo off
phpdoc ^
--directory "I:\" ^
--target "C:\tests\project-doc"
... but:
PHP Version 5.3.5
phpDocumentor version 1.4.3
Parsing configuration file phpDocumentor.ini...
(found in C:\Archivos de programa\PHP\pear\data/PhpDocumentor/)...
done
Maximum memory usage set at 256M after considering php.ini...
using tokenizer Parser
a target directory must be specified
try phpdoc -h
This error message is the same if I create "C:\tests\project-doc" before.
What's exactly wrong in my syntax?
phpDocumentor can indeed run against "undocumented" code. It builds its docs based on the code itself, and uses the docblocks as additional info (and additional organization, in the case of #package and #subpackage tags).
I'd suggest starting with phpDocumentor against your existing code, and work towards clearing out the warnings you see in the errors.html file that results -- this file is generated in the top level of your output docs, but there isn't any link to it from the output docs.
Once you have those cleared, you can start running phpDocumentor with the -ue argument (--undocumentedelements), which will add new warnings to errors.html, highlighting (in much greater detail) things that still need to be documented in docblocks.
Now, as for the issue you're having trying to run the program against code on a shared drive, I'm not sure what's wrong there. The script is clearly able to execute PHP and find the phpDocumentor code itself. You might try putting the arguments in the same line, rather than using the ^ as a line-feed escape character, and perhaps remove the quotes around the paths (since no spaces exist in the paths).
I think I've found what the issue is. The parameter parser is very picky and it doesn't like neither UNC paths nor bare root directories. If I replace this:
--directory "I:\"
... with this:
--directory "I:\."
... it finally starts running.
I suppose it's a bug. Their bug tracker doesn't seem to be public so I don't know if it's a known issue.
How to configure poedit to extract strings from xml file?
I have Zend Framework navigation items in .xml like this:
<entry-i>
<label>Text to translate</label>
<params>
...
<params>
<entry-i>
And I want poedit to read just messages from <label>s.
I have been searching for a solution as well, and I have just gotten it to work!
In Poedit (I have 1.4.2), add a new parser (Edit > Preferences) with the following properties:
Language: XML
List of extensions separated by semicolons (e.g. .cpp;.h): *.xml
Parser command: xgettext --force-po -o %o %C %K %F -L glade
An item in keywords list: -k%k
An item in input files list: %f
Source code charset: --from-code=%c
In your translation project, add label and title to your keyword list and update the catalog.
The above advice to abuse the Glade extractor to parse non-Glade XML files is misguided. It’s never going to work well (case in point: some comments around here). Of course, it was better than nothing back in 2010.
Starting with gettext 0.19.7 (bundled with Poedit since 1.8.7), there’s a better way: there’s now builtin support in gettext for custom XML files via ITS rules.
The best way to extract strings from a custom XML file is to
Add a custom extractor with your extension, specifying standard gettext invocation, without the -L glade bit.
Write ITS rules for your file format.
Put them in the location of other .its and .loc files in Poedit’s installation.
For anyone running into problems with the configuration for Poedit on windows, specifically if you get an error message saying that glade and expat are not available, replace the supplied xgettext.exe with current one from the gnuwin32 project:
http://gnuwin32.sourceforge.net/packages/gettext.htm
You need to download the binaries and the dependencies. However, only the binary xgettext.exe must be extracted and related files (just run it and it will tell you what is missing)
Looks like PoEdit does not support XML yet.
I have created a little php script, to extract the labels to .php file,
which PoEdit does understand.
$xml = simplexml_load_file("../application/configs/navigation.xml")
or die("Error: Cannot open XML file");
echo '<?';
foreach($xml->xpath('//label') as $label){
echo 'echo _("'.$label.'");'. PHP_EOL;
}
It worked great!! I found the problem about "glade not supported" using Poedit 1.4.6 in Windows 7 but I fixed by downloading last gnuwin32 binaries and dependencies as user496209 said. Don't download the complet package because PoEdit comes with its own gettext library, so just donwload binaries and dependencies and replace the requested files into the poedit folder.