Navicat set default character set - navicat

The default character set, when creating a new database in Navicat, is latin1.
How can I change the default into utf8 with default collation utf8_general_ci?

Change the my.cnf
cat /etc/my.cnf
[mysqld]
default-storage-engine = innodb
character-set-server = utf8
transaction-isolation = read-committed

This is not about navicat, but about mysql settings.
mysql.you can change the default-character-set=latin1 location in the ini file to default-character-set=utf8 and then try it by restarting mysql.

Related

Hash ("#") symbol in /etc/environment causes string to be split

I'm trying to add an environment variable to my system via
sudo nano /etc/environment
The value is a long string containing a hash, #.
With the # included, the string is not stored fully; characters after the # are gone.
Without the # included, the string is stored fully.
I have tried to wrap the string in " ":
MY_VARIABLE="34534554345 # DFGDGDFG"
I expect the variable to be stored fully, like this:
34534554345#DFGDGDFG
Not this:
34534554345
PAM interprets /etc/environment, not a shell. It's intended to be simple KEY=VALUE on each line with no need for quotes. # marks a comment and there is no way to escape it.
You can use /etc/profile to define your environment variable. It should make it available system wide in most cases.
/etc/environment
TEST2="12345#6789"
/etc/profile
export TEST="12345 #6789"
Result:
root#tempmon:~ $ env|grep TEST
TEST=12345# 6789
TEST2=12345

Puppet heredoc with double-quotes in different lines

I would like to pass a multi-line command into a Puppet (4.10.12) exec resource. The following fails with "syntax error at 'sudo'":
exec { 'create databases':
command => $("EOT")
sudo -u postgres psql -c
"CREATE DATABASE db1 ENCODING 'utf8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';
CREATE DATABASE db2 ENCODING 'utf8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';
CREATE DATABASE db3 ENCODING 'utf8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8'"
|-EOT,
}
I assume what is challenging about this case is that the two double-quotes appear on different lines. So what is the right heredoc syntax for a case like this?
I believe you need to add the L switch to your heredoc, and add a \ to the end of each line to escape the new line.
$command = $("EOT"/L)
sudo -u postgres psql -c\
"CREATE DATABASE db1 ENCODING 'utf8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';\
CREATE DATABASE db2 ENCODING 'utf8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';\
CREATE DATABASE db3 ENCODING 'utf8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8'"
|-EOT
exec { 'create databases':
command => $command,
}
You can view documentation here under "suppressing literal line breaks".
The following now works:
exec { 'create databases':
command => #("EOT"/L)
sudo -u postgres psql \
-c "CREATE DATABASE db1 ENCODING 'utf8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8'" \
-c "CREATE DATABASE db2 ENCODING 'utf8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8'" \
-c "CREATE DATABASE db3 ENCODING 'utf8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8'"
|-EOT
}
The following changes were necessary:
use `#' instead of '$' to refer to heredoc (typo)
use three -c options instead of one (in order to avoid error CREATE DATABASE cannot be executed from a function or multi-command string)
use heredoc switch L (as suggested by #mardotio)
I'll accept the other answer since it contains an important element (and is by a new contributor :-)

Unicode character not visible while doing cat

I have a CSV file generated by a windows system. The file is then moved to linux. The linux environment is NAME="Red Hat Enterprise Linux Server".VERSION="7.3 (Maipo)".ID="rhel".
When I use vi editor, all characters are visible. For example, one line is given :"Sarah--bitte nicht löschen".
But when i cat the file, i get something like "Sarah--bitte nicht l▒schen".
This file is consumed by datastage application and this unicode characters are coming as "?" in datastage. Since cat is not showing the character properly, I believe the issue is at the linux server. Any help is appreciated.
vi reads the file using encoding according fenc setting and show the content using your locales setting ($LANG env). If fenc is different from LANG, vi can handle the translate.
But cat doesn't handle the translate, it always output the exact byte stream without any convert.
Your terminal will show the output content of both vi and cat using your local PC locale setting.

how to select special character in oracle under linux environment

Can you please help me regarding
How to select below query in Oracle.
I am trying to spool a special character from SQL*plus. But it is showing like ????
select '§' from dual;
Unless your database character set is defined to US7ASCII this should be no problem.
You local character set has to match setting of NLS_LANG.
Example:
$ locale charmap
UTF-8
$ echo $LANG
en_US.UTF-8
Then NLS_LANG environment variable should be set to
NLS_LANG={your_language}_{your_country}.AL32UTF8
Then SQL*Plus should work fine.

how to set P4COMMANDCHARSET value while P4CHARSET is value of utf16?

Trying to use p4.exe command line to manipulate perforce. Because the server uses unicode so at first I changed the P4CHARSET value to utf16le-bom(p4 set P4CHARSET=utf16le-bom). Later I try the command 'p4 login' the console returned 'p4 can't support a wide charset unless P4COMMANDCHARSET is set to another charset.'. After reading the guidance from the page ftp://ftp.perforce.com/perforce/r08.2/doc/user/i18nnotes.txt I know when the P4CHARSET is set to utf16 or 32 the P4COMMANDCHARSET has to be set to something else so it can read the command line command. But every time I used the command 'p4 set P4COMMANDCHARSET=winansi' it still return the same error info said that it can't support the wide charset. Now even the 'p4 help' command is not working, can anyone help me with this? thanks
Try forcing the command charset:
p4 -Q winansi login
If that works it just means that you haven't set P4COMMANDCHARSET correctly in your environment. Try running p4 set and see where it's reading environment data from.
And see this page for more info: http://answers.perforce.com/articles/KB_Article/Internationalization-and-Localization#i18n

Resources