Non-ascii characters in velocity templates are broken when displayed - unicode

I have non-ascii chars in velocity template files. And when processed they are garbled.
The files are saved in UTF-8 encoding and response header contentType is also set to text/html;charset=UTF-8.
What else can be done?

Ok, so the solution was to set up following velocity properties (part of Spring's bean def):
<entry key="input.encoding" value="UTF-8"/>
<entry key="output.encoding" value="UTF-8"/>

Related

How to use single_media_upload

I am looking for an example for simple use of single_media_upload in SULU AdminUI.
I have a player form, and it has single_media_selection type of field, and it works OK.
Now, how can I use single_media_upload, because, when I replace it instead of single_media_selection, it shows not picture in form after save (but it saves image).
<property name="photo" type="single_media_selection" colspan="4" >
<meta>
<title>playerinfo.playerimage</title>
</meta>
<params>
<param name="types" value="image"/>
</params>
</property>
I replace with
<property name="photo" type="single_media_upload" colspan="4" spaceAfter="2">
<params>
<param name="upload_text">
<meta>
<info_text>app.player_info_upload</info_text>
</meta>
</param>
<param name="skin" value="default"/>
<param name="empty_icon" value="su-user"/>
<param
name="collection_id"
type="expression"
value="service('sulu_media.system_collections.manager').getSystemCollection('sulu_media')"
/>
</params>
</property>
In Entity itself, field is MediaInterface type.
The single_media_upload field-type is not interchangeable with the single_media_selection type. It was implemented for managing the avatar/logo of the built-in contact/account entity and was not optimized for other usecases yet. At the moment, the single_media_upload creates a new media version for the selected media entity rather than creating a separate media entity when uploading a file. This behaviour differs substantially from the single_media_selection and might not fit your usecase. This is also the reason why the field-type is not listed in the Sulu documentation yet.
That said, the reason for your problem is likely that the single_media_upload field-type uses a different data format than the single_media_selection. In general, the field-types of the Sulu form view expect that your API returns the data in the same format as it is sent to the server when submitting the form (see the Form configuration section in the Sulu documentation). You can see the data that is sent to the server by inspecting the request that is made when pressing the save button in the network panel development tools of your browser.
In the case of the single_media_upload field-type, the data that is sent to the server looks like this:
{
"id": 33,
"url": "/media/33/download/photo-1535683939029-0030b4de2382.jpeg?v=1",
"thumbnails": {
"sulu-400x400": "/uploads/media/sulu-400x400/03/33-photo-1535683939029-0030b4de2382.jpg?v=1-0",
...
}
}
If you want to use the field-type in the form of your custom entity, you need to adjust your controller (or the serialization of your entity) to match this format.

Translate language of web page

i translate the jasperserver_message.properties to amharic which contain label and message used in the main jasper reports server user interfaceand saved jasperserver_message_am.properties.but it shows the word like these...
áá° á¢ááµá¤ áªáá­áµ ááá¥á áªá« á¥áá³á á
á°áá áá¡
i specified the locale in applicationContext-security.xml
bean id="userLocalesList"
class="com.jaspersoft.jasperserver.war.common.LocalesListImpl">
<property name="locales">
<list>
<value type="java.util.Locale">en</value>
<value type="java.util.Locale">fr</value>
<value type="java.util.Locale">it</value>
<value type="java.util.Locale">de</value>
<value type="java.util.Locale">ro</value>
<value type="java.util.Locale">ja</value>
<value type="java.util.Locale">am</value>
</list>
</property>
what can i do?
use these website ([[1]: https://www.branah.com/]) and convert (key=value)the value to UTF-16 and place to value of key
for example:
key=value
LOGIN_WELCOME_OS=Welcome to Jaspersoft
and when u localize change the value(Welcome to Jaspersoft) to your language and convert ur languge to UTF-16 using these https://www.branah.com/ website
like:- LOGIN_WELCOME_OS=ወደ ጃስፐርሶፕ እንኳን በደህና መጡ
then change the value to UTF-16
LOGIN_WELCOME_OS =\u12c8\u12f0 \u1303\u1235\u1350\u122d\u1236\u1355 \u12a5\u1295\u12b3 \u1295 \u1260\u12f0\u1205\u1293 \u1218\u1321
You have to convert to ascii format. Please use this command "native2ascii jasperserver_message_am.properties jasperserver_message_am_converted.properties" . Please rename converted(Output) file to "jasperserver_message_am.properties" and replace in "WEB-INF\bundles" folders and restart Tomcat. As an alternative you can use this site https://native2ascii.net/ for converting to ascii.

In Filemaker, is it possible to import into Container fields from XML?

The XML FMPXMLRESULT grammar documentation states:
XML export does not support exporting container field data.
which seems to imply that it's possible to import (it does also specify that you can denote a field as type "CONTAINER" in the XML). However, I have found zero documentation as to how this might be done.
Is it possible? I get that there are ways of getting e.g. an image file into Filemaker after the fact, but can I just specify it in the XML beforehand, negating the need to have additional scripts or post-processing the import (not to mention something that works in Filemaker 11 or below)?
You can import file references, but not binary data. (And you'll have to specify the field as TEXT type in the XML file.) For example:
<?xml version="1.0" encoding="UTF-8"?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="01-25-2011" NAME="FileMaker"
VERSION="ProAdvanced 11.0v3" />
<DATABASE DATEFORMAT="M/d/yyyy" TIMEFORMAT="h:mm:ss a"
LAYOUT="" NAME="" RECORDS="" />
<METADATA>
<FIELD EMPTYOK="YES" MAXREPEAT="1" TYPE="TEXT" NAME="Path" />
</METADATA>
<RESULTSET FOUND="">
<ROW>
<COL>
<DATA>image:test.jpg</DATA>
</COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>
The path must be in FileMaker format; here I used a relative path to test.jpg in the same directory as the file (will only work for local files), but it can also be an absolute path, e.g.:
imagewin:/C:/Some/Path/test.jpg
Your best option is probably to import Base64-encoded data, then use the Base64Decode function to decode it.
importing images, preferably from http
I am not sure what exactly that means. If your XML contains a link to an image, then the only thing you can do with it is import the link as text. If you are using version 12 or higher, you can follow this with the Insert From URL script step (for each imported record).

Eclipse XML formatting breaks / changes value of list of Spring XML

I have a spring list defined in xml as -
<list>
<value> </value>
</list>
However, Eclipse (Juno) has decided to format it as -
<list>
<value>
</value>
</list>
Therefore, changing my value to space + line break for any developer that might format the XML using Eclipse.
I don't want to change the Eclipse formatting rules, but how do I change the Spring XML to avoid this issue? Is there an attribute I can use instead to store the value? Thanks.
Check the schema, or use xml:space. http://www.simonstl.com/xmlprim/xmlupdate/atts.html

Jasper report using same template to render in CSV and PDF formats

We are using one template to render the report in CSV and PDF format. But the problem is we need to have report split into pages in PDF but not in CSV. Is it possible to alter the rendering options based on the format in one template. So that we have CSV without pagination information and PDF divided into page. In such a case 2 separate templates one for CSV and one for PDF should be used? or this can be achieved using one template?
Finally found the answer. In the template following properties need to be set
<property name="net.sf.jasperreports.export.csv.exclude.origin.keep.first.band.columnHeader" value="columnHeader" />
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.columnFooter" value="columnFooter" />
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.pageFooter" value="pageFooter" />
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.lastPageFooter" value="lastPageFooter" />
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.summary" value="summary" />
Using JRCsvMetadataExporter solved similar problem. This class extracts the data from the template ignoring the rendering part. Check out the sample here