diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
new file mode 100644
index 22815bc..be0d602
*** a/doc/src/sgml/libpq.sgml
--- b/doc/src/sgml/libpq.sgml
*************** int PQclientEncoding(const PGconn *<repl
*** 5377,5383 ****
  </synopsis>
  
        Note that it returns the encoding ID, not a symbolic string
!       such as <literal>EUC_JP</literal>. To convert an encoding ID to an encoding name, you
        can use:
  
  <synopsis>
--- 5377,5384 ----
  </synopsis>
  
        Note that it returns the encoding ID, not a symbolic string
!       such as <literal>EUC_JP</literal>. If unsuccessful, it returns -1.
!       To convert an encoding ID to an encoding name, you
        can use:
  
  <synopsis>
diff --git a/src/backend/utils/mb/wchar.c b/src/backend/utils/mb/wchar.c
new file mode 100644
index 6d03a10..73ef112
*** a/src/backend/utils/mb/wchar.c
--- b/src/backend/utils/mb/wchar.c
*************** pg_mic_mblen(const unsigned char *mbstr)
*** 1778,1785 ****
  int
  pg_encoding_mblen(int encoding, const char *mbstr)
  {
- 	Assert(PG_VALID_ENCODING(encoding));
- 
  	return ((encoding >= 0 &&
  			 encoding < sizeof(pg_wchar_table) / sizeof(pg_wchar_tbl)) ?
  		((*pg_wchar_table[encoding].mblen) ((const unsigned char *) mbstr)) :
--- 1778,1783 ----
*************** pg_encoding_mblen(int encoding, const ch
*** 1792,1799 ****
  int
  pg_encoding_dsplen(int encoding, const char *mbstr)
  {
- 	Assert(PG_VALID_ENCODING(encoding));
- 
  	return ((encoding >= 0 &&
  			 encoding < sizeof(pg_wchar_table) / sizeof(pg_wchar_tbl)) ?
  	   ((*pg_wchar_table[encoding].dsplen) ((const unsigned char *) mbstr)) :
--- 1790,1795 ----
*************** pg_encoding_dsplen(int encoding, const c
*** 1808,1815 ****
  int
  pg_encoding_verifymb(int encoding, const char *mbstr, int len)
  {
- 	Assert(PG_VALID_ENCODING(encoding));
- 
  	return ((encoding >= 0 &&
  			 encoding < sizeof(pg_wchar_table) / sizeof(pg_wchar_tbl)) ?
  			((*pg_wchar_table[encoding].mbverify) ((const unsigned char *) mbstr, len)) :
--- 1804,1809 ----
