Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-csv-import
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-csv-import
Commits
ba648ea7
Commit
ba648ea7
authored
Oct 08, 2020
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added FEFF bom (byte order mark) check in order to avoid errors with the
first column
parent
6a352e85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
import-2.tcl
www/import-2.tcl
+32
-0
No files found.
www/import-2.tcl
View file @
ba648ea7
...
...
@@ -82,6 +82,38 @@ set header_len [llength $headers]
set
values_lol
[
im_csv_get_values
$lines
_content
$separator
]
# ---------------------------------------------------------------------
# Code set check - detects wrong unicode chars or the beginning of an Excel file...
# ---------------------------------------------------------------------
set
max_char 0
set
hex_chars
{}
foreach
char
[
split
$header
""
]
{
set c
[
scan
$char
%c
]
if
{
$c
>
$max
_char
}
{
set max_char
$c
}
lappend hex_chars
[
format
"%X"
$c
]
}
# ad_return_complaint 1 "sep='$separator',<br>header=$header,<br>headers=$headers,<br>max_char=$max_char,<br>hex=$hex_chars "
if
{
"FEFF"
eq
[
lindex
$hex
_chars 0
]}
{
ad_return_complaint 1
"<b>Something is wrong with your CSV file.<br>We found 'FEFF' as the first (invisible) character in your file</b>:<br>
<br>
Some text editors add a FEFF 'byte order mark' (BOM) in front of the text.<br>
This format is not supported by
\]
po
\[
.<br>
Please use a correctly formatted CSV in UTF-8 format without BOM.
"
ad_script_abort
}
# ---------------------------------------------------------------------
# Continue parsing the header
# ---------------------------------------------------------------------
# Check if there are lines with less then 4 elements
# fraber 160315: Exporting from Excel, the last columns may be shorter
# set error [im_csv_import_check_list_of_lists $values_lol
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment