title: How to resolve "...is not available in this font's encoding"?
body: <p>So I am using PDFBox to fill in some pdfs. So far everything was great - I created a form in pdf with Avenir Light font, and I could fill it in. However, the problem that just now showed up, is that when I am trying to fill the pdf using letters such as <code>ł</code>, <code>ą</code>, <code>ć</code>  ... I get the following error:</p>
  
  <pre><code>U+0142 is not available in this font's encoding: MacRomanEncoding with differences
  </code></pre>
  
  <p>with different numbers.</p>
  
  <p>Now, my question is - how can I fix this, so that I can fill the form automatically? When I open the pdf in Acrobat Reader, I can insert those letters, and I dont get any errors. Here is how I set the field:</p>
  
  <pre><code>public void setField(PDDocument document, PDField field, String value ) throws IOException {
      if( field != null &amp;&amp; value != null) {
          try{
              field.setValue(value);
          } catch (Exception e){
              e.printStackTrace();
          }
      }
      else {
          System.err.println( "No field found with name:" + field.getPartialName() );
      }
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I've been trying to upload my own Avenir-Light.tff like this:</p>
  
  <pre><code>PDFont font = PDType1Font.HELVETICA;
  PDResources res = new PDResources();
  COSName fontName = res.add(font);
  acroForm.setDefaultResources(res);
  String da = "/" + fontName.getName() + " 12 Tf 0 g";
  acroForm.setDefaultAppearance(da);
  </code></pre>
  
  <p>However, this doesn't seem to have any impact on the printed fields, and throws almost the same message:</p>
  
  <pre><code>U+0104 ('Aogonek') is not available in this font Helvetica (generic: ArialMT) encoding: WinAnsiEncoding
  </code></pre>