I am trying to import a UTF-8 encoded csv file into a tabularx environment to sort the table in ascending order with respect to the first column. When compiling I get the error: Package inputenc Error: Unicode char (U+FEFF)(inputenc) not set up for use with LaTeX. \end{tabularx}.
Here is my code
\documentclass[12pt,a4paper]{report}
\usepackage{graphicx}
\usepackage{tabularx,booktabs}
\usepackage[norsk]{babel}
\usepackage{datatool}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{booktabs}
\usepackage{float}
\usepackage{textcomp}
\begin{document}
\DTLloaddb[noheader,keys={sangnr,engelsk,norsk}]{test}{test.csv}
\DTLsort{sangnr=ascending}{test}
\begin{table}[H]
\scriptsize
\begin{tabularx}{\linewidth}{>{\bfseries}l X X }
\toprule
\textnumero &
Engelsk tittel &
Norsk tittel \\
\midrule
\DTLforeach{test}{%
\sangnr=sangnr,\eng=engelsk,\nor=norsk}{%
\sangnr & \eng & \nor \\
}
\\[-\normalbaselineskip] \bottomrule
\end{tabularx}
\end{table}
\end{document}
test.csv
%sangnr, engelsk, norsk
45, Have Thine Own Way{,} Lord, Dann meg{,} Herre
55, Jesus rose from the dead, Jesus stod opp fra døden
454, How Great Thou Art, Å{,} Store Gud
I know I can save the csv file in ANSI and write \o for ø, but this will be rather tedious in the long run. Can anyone see what I am doing wrong?
\DeclareUnicodeCharacter{FEFF}{}to the preamble I got another errorFile ended while scanning use of \@dtl@trim.. Upon removing the%from my first line, the document compiled with no errrors! However it does not seem to sort my table anymore. The order in my csv file is 45, 55, 454. After compiling the order is 45, 454, 55. It is neither ascending or following the order in the csv file. It also prints my keyssangnr, engelsk, norskat the buttom of the table. Any suggestions why this is happening? – Eirik B Mar 26 '17 at 10:28