@@ -738,8 +738,13 @@ def bip(c):
738738 try :
739739 if shell_list [0 ] == '.once' :
740740 shell_list [0 ] = ' '
741- encode_in = 'utf-8-sig' if os .name == 'nt' else 'utf-8'
742- csv_file = shell_list [1 ]
741+ encode_in = 'utf-8'
742+ if '--bom' in shell_list : # keep access to the option
743+ encode_in = 'utf-8-sig'
744+ if shell_list [1 ] == '--bom' :
745+ csv_file = shell_list [2 ]
746+ else :
747+ csv_file = shell_list [1 ]
743748 if (csv_file + "z" )[0 ] == "~" :
744749 csv_file = os .path .join (self .home , csv_file [1 :])
745750 self .conn .export_writer (instruction , csv_file ,
@@ -1620,10 +1625,10 @@ def _main():
16201625SELECT ItemNo, Description FROM Item; -- see all is back to normal
16211626RELEASE SAVEPOINT remember_Neo; -- free memory
16221627\n \n -- '.' commands understood:
1623- -- .once FILENAME Output for the next SQL command only to FILENAME
1628+ -- .once [--bom] FILENAME Output of next SQL command to FILENAME [with utf-8 bom]
16241629-- .import FILE TABLE Import data from FILE into TABLE
16251630-- (create table only if it doesn't exist, keep existing records)
1626- .once '~this_file_of_result.txt'
1631+ .once --bom '~this_file_of_result.txt'
16271632select ItemNo, Description from item order by ItemNo desc;
16281633.import '~this_file_of_result.txt' in_this_table
16291634
0 commit comments