Question: I am new to this but I have tried to put some code together, however I'm getting errors flagging up and it doesn't seem to work. I would like some input to help debug it.

I have a cookie called "country" saved with a value of "AZ". I want to pull this cookie using javascript and store it as a variable, then use it in my google map page. This is the code I have:

```
// Setup variable with blank value
var country_code ='';
// Use read_cookie function to pull "country" value from cookie
if (country_code) var country_code = read_cookie('country');
// Make sure its value is lower case (required)
country_code = country_code.toLowerCase();

```

And then a bit further down:

```
var input = document.getElementById('loc');
var options = { types: [], ComponentRestrictions({ 'country': country_code });};
var autocomplete = new google.maps.places.Autocomplete(input, options); 

```

The first error is that I have too many brackets on the "componentrestriction" line. How should this be done? It looks like I am closing them correctly, I encase the componentrestrictions with ({}); and var options with {};

EDIT: This is the read cookie function code I found on stackoverflow:

```
// Reading Cookie V0.1
function read_cookie(key){
    var result;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? (result[1]) : null;
}

```

Answer: 
Your problem doesn't come from PHP: your `"MY_CURRENCY"."SYMBOL"` column is probably defined as `VARCHAR2(4 byte)` instead of `VARCHAR2(4 CHAR)`.

Since an unicode character may take more than one byte, you have to use `CHAR` when you define your tables **and** variables. This is why you are getting an Oracle error.

You should be able to modify your table:

```
ALTER TABLE MY_CURRENCY MODIFY (SYMBOL VARCHAR2(4 CHAR));

```

And then insert any 4 characters into this column.
First off, what version of Oracle XE are you using and what character set are you using? If you are using the 10g version of Oracle XE, there was an option to download a version that used a Western European character set in addition to a version that used a Unicode character set. What do these queries return?

```
SELECT *
  FROM v$version

SELECT *
  FROM v$nls_parameters
 WHERE parameter LIKE '%CHARACTERSET';

```

Assuming that the database is using a Unicode character set, by default, Oracle specifies the length of a `VARCHAR2` column (or a `NVARCHAR2` column) in terms of bytes, not characters. If you have data that is outside of the US7ASCII character set, the AL32UTF8 character set requires more than 1 byte of storage. It appears that the data that you are trying to insert into the `SYMBOL` column requires 7 bytes of storage though it may comprise only 4 characters. 

There are two general approaches to dealing with this. The first is to triple the size of the columns that you allocate (a single character in the AL32UTF8 character set normally requires no more than three bytes though some exceptional cases require four bytes). Rather than specifying a length of 4 bytes, you would specify a length of 12 bytes (`CODE` would become 9 bytes and `NAME` becomes 192 bytes). The second is to change the `NLS_LENGTH_SEMANTICS` so that a `VARCHAR2` column allocates a size in characters rather than bytes

```
ALTER SYSTEM SET nls_length_semantics = CHAR scope= BOTH

```

Once you do that (you'll need to log in as SYS to be able to change initialization parameters), any scripts generated by your framework will use character semantics by default.