unsupported encoding: UTF-8 - utf-8

I have ant script that include a javac blocks for components:
<javac destdir="<component path>\bin" source="1.7" target="1.7" encoding="UTF-8 " includeantruntime="false"> <!-- includes="**/*.java" -->
<src path="<component path>\src"/>
<classpath refid="classpath.base_componentName" />
</javac>
because we have in code some utf-8 languages (such as: Greek, Japanese, Chineee) text there was a need to use encoding="UTF-8" (instead of Cp1252).
When running this script getting this error:
error: unsupported encoding: UTF-8
I'm running the script with alias build that include the java version that I want to use:
export PATH="/c/Program Files/Apache Software Foundation/apache-ant-1.9.11/bin:/c/Program Files/Java/jre7/bin":$PATH
alias build="ant -f tools/build/ant-scripts/buildComponents.xml -Dproperties.file="buildAllWars.properties""
tried to use different java versions (1.7, 1.8) but didn't help!

You actually specify encoding="UTF-8 ". Note the trailing space. Remove that space, by changing it to encoding="UTF-8".

Related

Environment variables in ROS YAML file?

Is there a way to use environment variables in a ROS yaml file that gets loaded during a launch file?
For example,
test.launch:
<launch>
<rosparam command="load" file="example.yaml" />
</launch>
example.yaml:
vehicle_name: "${VEHICLE_NAME}_robot"
I know that you could load the environment variable as a param in the launch file using the <env> or <optenv> tags, but when there are a lot of parameters, it's much neater to have them defined in a separate .yaml file. Is there a recommended way to do this?
The rosparam tag has an attribute subst_value to enable the env, optenv, etc. substitution args for the YAML text when added directly in the launch file. That is the following works:
<launch>
<!-- works -->
<rosparam subst_value="true">
foo: $(env USER)
</rosparam>
</launch>
For ROS Kinetic and later, it also works when using an external YAML file:
<launch>
<rosparam file="/path/to/conf.yaml" subst_value="true" />
</launch>
No, roslaunch just uses PyYAML's .load and PyYaml does not support reading env variables in yaml files.
You could create multiple yaml files different names and load them selectively using env variables in launch files, for example:
<launch>
<rosparam command="load" file="$(optenv VEHICLE_NAME default_vehicle_name)_example.yaml" />
</launch>
`

Scala vs. Groovy behavior when printing UTF-8 char in Windows terminal

My question is similar to Printing Unicode from Scala interpreter and scala default encoding in windows shell, but goes into more detail WRT different behavior of Scala (version 2.12.2) vs. Groovy (version 2.4.7).
I have the following code snippet (which happens to be both valid Scala and Groovy code):
println("└─ ");
println("├─ ");
println(System.getProperty("file.encoding"));
When running the scala interpreter on it the Windows terminal (all of cmd, PowerShell, Git Bash / mintty) it shows
$ scala a.scala
??
??
Cp1252
However, running the exact same code through the groovy interpreter it shows:
$ groovy a.scala
└─
├─
Cp1252
My understanding from reading the answers to the linked questions is that the output is (solely) dependent on the value of the file.encoding system property. If so, how can the output be different between Scala and Groovy then if the used file.encoding is the same?
Edit: This answer seems to confirm it's an issue with the encoding used by the Scala compiler to read the source code file, which seems to default to whatever file.encoding is set to, even if the file clearly is UTF-8 encoded. I'm still wondering why Scala is not as smart as Groovy here...
Edit 2: I can work around the issue by running
$ scala -Dfile.encoding=UTF8 a.scala
└─
├─
UTF8
but still this dos not answer the question why Groovy does get it right despite file.encoding being set to Cp1252.
I think it's connected with different source encoding during compilation step
try this instead of println("├─ ");
println("\u251C\u2500");
or for groovy there is a parameter --encoding to specify the encoding of the source files.
quite sure for scala should be the same parameter
finally better not to use non-ASCII characters in your source code.
I used this service to convert chars (but any ide can do it for you)

How to properly structure UWP app icons in AppxManifest.xml file for a Win32 app converted using Desktop Bridge (Project Centennial)

I'm trying to convert my Win32 app into a UWP app using Project Centennial converter (i.e. Desktop bridge.)
After the app is converted, I need to adjust AppxManifest.xml file to ensure the following:
That all icon formats are configured properly.
That I properly specified app resources for: English (US), German, French and Russian languages.
So I followed this Windows 10 icon guide and created the following .png images that were all placed into the Assets folder. I got these:
And my AppxManifest.xml was structured as such:
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap2="http://schemas.microsoft.com/appx/manifest/uap/windows10/2" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10">
<Identity Name="MyApp.Name" ProcessorArchitecture="x86" Publisher="CN=My Name, O=My Name, STREET="Street Address", L=City, S=State, PostalCode=12345, C=US" Version="1.2.3.4" />
<Properties>
<DisplayName>MyApp.Name</DisplayName>
<PublisherDisplayName>PublisherName</PublisherDisplayName>
<Logo>Assets\StoreLogo-50x50.png</Logo>
</Properties>
<Resources>
<Resource Language="en-us" />
<Resource Language="de-DE" />
<Resource Language="fr-FR" />
<Resource Language="ru-RU" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14342.0" MaxVersionTested="10.0.14342.0" />
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
<Applications>
<Application Id="MyApp.Name" Executable="VFS\Users\ContainerAdministrator\AppData\Local\PublisherName\App Name\RunFile.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements DisplayName="My App Name" Description="My app does this ... and this ..."
BackgroundColor="#aabbcc"
Square71x71Logo="Assets\AppNameSmallTile.png"
Square150x150Logo="Assets\AppNameMedTile.png"
Square310x150Logo="Assets\AppNameWideTile.png"
Square310x310Logo="Assets\AppNameLargeTile.png"
Square44x44Logo="Assets\AppNameAppList.png"
>
<uap:DefaultTile>
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo" />
<uap:ShowOn Tile="Square310x150Logo" />
<uap:ShowOn Tile="Square310x310Logo" />
</uap:ShowNameOnTiles>
</uap:DefaultTile>
</uap:VisualElements>
<Extensions />
</Application>
</Applications>
</Package>
So can someone answer these questions:
I'm somewhat confused about specifying icons for correct sizes and scaling. Did I do it correctly?
Do I need to specify scaling for Assets\StoreLogo-50x50.png icon as well?
And lastly, did I specify resources for 4 different languages correctly?
EDIT: While waiting, I tried compiling my AppxManifest.xml above with the assets I showed. But makeappx.exe tool gives me the following error:
MakeAppx : error: Error info: error C00CE015: App manifest validation
error: The app manifest must be valid as per schema: Line 22, Column
27, Reason: The attribute 'Square71x71Logo' on the element
'{http://schemas.microsoft.com/appx/manifest/uap/windows10}VisualElements'
is not defined in the DTD/Schema.
It evidently doesn't like the following icon sizes:
Square71x71Logo
Square310x150Logo
Square310x310Logo
But then even if I remove the icon sizes above from AppxManifest.xml, when I try to pack it with the following command:
"C:\Program Files (x86)\Windows Kits\10\bin\x64\makeappx.exe" pack /d "path-to-folder-to-pack" /p "path-to\MyAppxPackage.appx"
I get the following errors about naming assets for scaling:
MakeAppx : error: Manifest validation error: Line 22, Column 27,
Reason: The file name "Assets\AppNameMedTile.png" declared for element
"[local-name()='Applications']/[local-name()='Application']/[local-name()='VisualElements']"
doesn't exist in the package. If this file has multiple variations or
resource versions for language, scale, contrast, etc., use the /l
command line option to disable this validation. MakeAppx : error:
Manifest validation error: Line 23, Column 27, Reason: The file name
"Assets\AppNameAppList.png" declared for element
"[local-name()='Applications']/[local-name()='Application']/[local-name()='VisualElements']"
doesn't exist in the package. If this file has multiple variations or
resource versions for language, scale, contrast, etc., use the /l
command line option to disable this validation. MakeAppx : error:
Package creation failed. MakeAppx : error: 0x80080204 - The specified
package format is not valid: The package manifest is not valid.
Using suggested /l command as such:
"C:\Program Files (x86)\Windows Kits\10\bin\x64\makeappx.exe" pack /l /d "path-to-folder-to-pack" /p "path-to\MyAppxPackage.appx"
builds the package with a lot of warnings. But when I install it later, all icons in it seem to be blank.
There must be something that I'm missing here?
I see two main problems: you're defining tile images in the wrong place, and you don't talk at all about a resources.pri file.
The UAP schema is fairly involved, but also reasonably well documented, so make sure you respect its requirements. In particular, the uap:VisualElements element only has the image attributes Square150x150Logo and Square44x44Logo. If you want to define other sizes, they go in attributes on a child uap:DefaultTile element. Note that your uap:ShowOn elements' attributes include an incorrect Square310x150Logo that should instead be wide310x150Logo.
Once you sort that out, makeappx should succeed with your original command line, i.e., without the additional /l parameter. However this is not enough to make your alternate DPI images show up. For that you will need to create a resources.pri file. You can do this manually by using makepri.exe to create a template priconfig.xml, update it, then invoke makepri again to build the resources.pri from it.
Alternately, use a tool that will create an app package with a resources.pri for you (such as Visual Studio), and extract the resources.pri and add it to your package. Just make sure the locations you use in your package match the ones in the package created by the tool, as relative paths are stored in the resources.pri file. (As a bonus, you can look at the AppxManifest.xml that this creates to verify that your structure from the first part is correct. Just don't forget that apps using the desktop bridge will have additional namespaces and capabilities that Visual Studio won't offer.)

Changing gtksourceview files adding a style

I want to change the way list markers of markdown files are displayed in GEdit in the theme tomorrow_night-eighties.xml, which I downloaded from https://wiki.gnome.org/Projects/GtkSourceView/StyleSchemes. I know that GEdit loads its language specs from
/usr/share/gtksourceview-3.0/language-specs/
The markdown language file is markdown.lang. The styles are located in my users directory:
~/.local/share/gtksourceview-2.0/styles
What I did is the following:
I added: <style name="markdown:list-marker" foreground="#cc99cc" bold="true"/> to the list of available styles in the style document.in my user's .local/share/.... folder.
I changed in the language specs:
<style id="list-marker" _name="List Marker" map-to="markdown:list-marker"/>
in the <styles>...</styles> region / tag, in order to make it available for referencing further down.
My theme is set to the tomorrow_night-eighties.xml one I have in my ~/.local/share/gtksourceview-2.0/styles and a markdown file is opened. After the change GEdit doesn't highlight list markers at all anymore.
What I don't understand is, what is missing? I only changed a reference and introduced a new style and didn't change the regex at all, so why does that stop it from highlighting?
It seems GEdit does not automatically notice changes in those files and one has to re-import the styles in the preferences and just to be sure also restart GEdit if the language file changed.
There is a bug with identifiers for <context> and <language> tags when creating an id= attribute, perhaps also for the <style> tag.
see also in stackexchange
The prototypical test suite below was run in this environment:
linuxuser#ubuntu:~$ gedit -V
gedit - Version 3.28.1
linuxuser#ubuntu:~$ uname -a
Linux ubuntu 4.15.0-74-generic #84-Ubuntu SMP Thu Dec 19 08:06:00 UTC 2019 i686 i686 i686 GNU/Linux
linuxuser#ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
The test suite language file that demonstrates this failure:
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of GtkSourceView
special mods for extended background highlighting and comments MJS aka etx 2021
id (mandatory)
Identifier for the description.
This is used for external references and must be unique among language descriptions.
It can contain a string of letters, digits, hyphens ("-") and underscores ("_"). NOT!!!
as follows for id attribute of both tags language & context
empirical evidence gathered via simultaneously changing both id's to be identical
fails reliably: xRef
fail unreliably: x-ref X_-ef3
but aOk: xref xref3 x-ref3
-->
<language id="xRef" name="C..C xref augment cpp" version="2.0" _section="other">
<definitions>
<context id="special-multiline-comment" style-ref="def:note" > <!-- hi-liter -->
<start>/(\* .. .. .. \*)+/</start>
<end>\%{0#start}</end>
</context>
<!--Main context-->
<context class="no-spell-check" id="xRef" >
<include>
<context ref="special-multiline-comment"/> <!-- override MUST precede to supercede -->
<!-- actual language definition: editing hi lite stuff plus everything from C++ -->
<context ref="cpp:cpp"/>
</include>
</context>
</definitions>
</language>

Load language file during joomla (2.5) system plugin installation

I'm having a real hard time showing a localized string during the installation of a system plugin (in Joomla 2.5). The "normal" way with localized strings in the xml file doesn't seem to work, (see this other question: Language based installation description).
I now tried the way proposed there, to show the description via the install scripts. This kind of works (I can echo text successfully), however, I also can't localize there - when debugging the language it shows that the plugin.sys.ini is not loaded yet; I tried to manually load the file, but had no success with loading any of my plugin language files.
This is what I got so far (in a file named setupscripts.php):
<?php // no direct access
defined('_JEXEC') or die('Restricted access');
class plgsystemmyplgnameInstallerScript {
static function loadLanguage() {
$lang =& JFactory::getLanguage();
$lang->load('plg_system_myname', JPATH_ADMINISTRATOR);
}
function install($parent)
{
self::loadLanguage();
echo JTEXT::_("PLG_MYNAME_TEST_TEXT");
}
function uninstall($parent)
{
self::loadLanguage();
echo JText::_('PLG_MYNAME_UNINSTALL_TEXT');
}
function update($parent)
{
self::loadLanguage();
echo JText::_('PLG_MYNAME_UPDATE_TEXT');
}
function preflight($type, $parent) {}
function postflight($type, $parent) {
self::loadLanguage();
echo JText::_('PLG_MYNAME_INSTALL_TEXT');
}
}
But I only get ??PLG_MYNAME_TEST_TEXT?? ??PLG_MYNAME_INSTALL_TEXT?? (language debugging is turned on) during installation... weirdly enough, the language debug feature at the bottom of the page under "untranslated strings" shows "None" (where do the question marks then come from if not from a tried but failed translation???).
Tried some variations of it (with .sys at the end of the plugin name, since I actually think the setup strings should be in the .sys.ini file, without the second parameter (leaving it default), but no luck - no error, nothing in the log (in fact my log file isn't existing, probably there was no entry yet? can one set the log level with Joomla?). But never is there any file loaded (nothing changes under "loaded language files".
Anybody got an idea how to load the language properly?
Is there something special to consider when loading languages during setup? Why is there no error message if loading the languages fails? Do I maybe have to install the language files to a special location to get them recognized during installation? My current xml looks like this:
<extension version="2.5" type="plugin" group="system" method="upgrade">
<name>PLG_MYNAME</name>
<!-- ... author, copyright, version, .. -->
<scriptfile>setupscripts.php</scriptfile>
<files>
<filename plugin="myname">myname.php</filename>
<filename>setupscripts.php</filename>
<filename>index.html</filename>
<folder>sql</folder>
</files>
<!-- ... install->sql->file ... -->
<!-- ... uninstall->sql->file ... -->
<!-- ... update->schemas->schemapath ... -->
<languages [folder="admin"]>
<language tag="en-GB">en-GB.plg_system_myname.ini</language>
<language tag="en-GB">en-GB.plg_system_myname.sys.ini</language>
<!-- ... other languages ... -->
</languages>
<!-- ... config->fields->fieldset->field ... -->
</extension>
(the square brackes around folder="admin" are supposed to indicate that I tried both with and without this attribute. It doesn't change anything).
It only works on installation if you also copy the files to the admin language folder. If you look at the core extensions you will see that they do both. It's really a bug but that's the work around.
Finally I found out how to really do it. A thorough search in the google Joomla dev group brought up this very similar question.
Basically, the language files need to reside in a separate language folder it seems, and the files section also needs to reference them. My xml now looks like this:
<!-- ... everything else stayed the same, except: -->
<files>
<filename plugin="myplg">myplg.php</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>sql</folder>
</files>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.plg_system_myplg.ini</language>
<language tag="en-GB">en-GB/en-GB.plg_system_myplg.sys.ini</language>
<!-- .. other languages ... ->
</languages>
<!-- ... rest of the xml file ... -->
The language files are now all in separate subfolders... they get copied to the exact same location as before (administrator/language//...), but now the description from the XML is also localized!
I find it very weird that there are so many ways to specify language files, which all basically work except for the one corner case of the installation...
Hope this will help other people struggling with this!

Resources