How do I change the locale that JasperReports uses?

The locale is set during execution, not in the JRXML. Using Java, set the REPORT_LOCALE parameter for the report’s parameter map. For example: InputStream reportTemplate = getReportTemplate(); JRDataSource dataSource = getDataSource(); java.util.Map parameters = getParameters(); java.util.Locale locale = new Locale( “en”, “US” ); parameters.put( JRParameter.REPORT_LOCALE, locale ); JasperFillManager.fillReport( reportTemplate, parameters, dataSource ); Using Jaspersoft Studio, … Read more

Time zone issue involving date fns format()

You will need to subtract the time zone offset of your local time zone from the Date instance, before you pass it to format from date-fns. For example: const dt = new Date(‘2017-12-12’); const dtDateOnly = new Date(dt.valueOf() + dt.getTimezoneOffset() * 60 * 1000); console.log(format(dtDateOnly, ‘YYYY-MM-DD’)); // Always “2017-12-12” Problem You want to handle only … Read more

‘git log’ output encoding issues in Windows 10 CLI terminal

Okay, I experimented a bit and found out that Windows Git commands actually need UNIX variables like LC_ALL in order to display Polish (or other UTF-8 characters) correctly. Just try this command: set LC_ALL=C.UTF-8 Then enjoy the result. Here is what happened on my console (font “Consolas”, no chcp necessary): Update: Well, in order for … Read more

How do I strftime a date object in a different locale? [duplicate]

The example given by Rob is great, but isn’t threadsafe. Here’s a version that works with threads: import locale import threading from datetime import datetime from contextlib import contextmanager LOCALE_LOCK = threading.Lock() @contextmanager def setlocale(name): with LOCALE_LOCK: saved = locale.setlocale(locale.LC_ALL) try: yield locale.setlocale(locale.LC_ALL, name) finally: locale.setlocale(locale.LC_ALL, saved) # Let’s set a non-US locale locale.setlocale(locale.LC_ALL, ‘de_DE.UTF-8’) … Read more

IPython Notebook locale error [duplicate]

I summarize here the solution to be found on: http://blog.lobraun.de/2009/04/11/mercurial-on-mac-os-x-valueerror-unknown-locale-utf-8/ I added these lines to my .bash_profile: export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 I reloaded the profile: source ~/.bash_profile I then ran ipython again: ipython notebook Changing locales The above will work for the English language in a US locale. One may want different settings. At the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)