# How to highlight a non-ascii keyword using the listings package? [duplicate]

I'm trying to highlight a couple of keywords which contain non-ASCII characters using the listingsutf8 package. This is the relevant part of my document:

\usepackage[brazilian]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{listingsutf8}
\lstset{
extendedchars=true,
inputencoding=utf8x,
literate=%
{á}{{\'a}}1
{ã}{{\~a}}1
{ç}{{\c{c}}}1
{é}{{\'e}}1
{ê}{{\^e}}1
{õ}{{\~o}}1
{ó}{{\'o}}1
}


The ASCII only keywords are being highlighted correctly, but the Cenário and Então keywords are not. I have also tried with emph and changing inputencoding, but it doesn't work either:

\lstset{
inputencoding=utf8/latin1,
emph={Cenário, Cen\'ario, Cenario},emphstyle={\bfseries}
}


If it's relevant, the listing I'm trying to highlight comes from a separate file, using the \lstinputlisting command. If I had to guess, I would say that it has something to do with the literate params.

-

## marked as duplicate by Jubobs, Sean Allred, Speravir, Jesse, ChrisSMar 11 at 2:09

The detection of keywords in listings doesn't work well with UTF-8 encoded files. With latin1 encoding, specifying Cenário as keyword does what you want. Please, try providing a minimal example. –  egreg Dec 9 '11 at 16:23
Try the listingsutf8 package from the oberdiek bundle. It offers a workaround exactly for the \lstinputlisting command.
I have tried (and edited the question to reflect the changes I have made), but even with the listingsutf8 package the keyword is not being highlighted. –  Tomas Mattia Dec 10 '11 at 20:25